Skip to content

boost.python wrapper, why? #1651

@yaoli

Description

@yaoli

I don't quite understand the logic of using PyBlobWrap, can someone explain to me please?

// We need another wrapper (used as boost::python's HeldType) that receives a
// self PyObject * which we can use as ndarray.base, so that data/diff memory
// is not freed while still being used in Python.
class PyBlobWrap : public PyBlob {
public:
PyBlobWrap(PyObject *p, const PyBlob &blob)
: PyBlob(blob), self_(p) {}

bp::object get_data();
bp::object get_diff();

private:
PyObject *self_;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions