pyd.references

Members

Functions

get_d_reference
T get_d_reference(PyObject* _self)

Returns the object contained in a Python wrapped type.

get_python_reference
PyObject_BorrowedRef* get_python_reference(T t)

If the passed D reference has an existing Python object, return a borrowed reference to it. Otherwise, return null.

wrap_d_object
PyObject* wrap_d_object(T t, PyTypeObject* type = null)

Returns a new Python object of a wrapped type.

Templates

PydTypeObject
template PydTypeObject(T)

_

is_wrapped
template is_wrapped(T)

A useful check for whether a given class has been wrapped. Mainly used by the conversion functions (see make_object.d), but possibly useful elsewhere.

reference_container
template reference_container(Mapping)

A bidirectional mapping of a pyobject and the d object associated to it. On the python side, these are weak references; we don't want to prevent python from reclaiming objects it is finished with. As such, on the D side, if you take PyObject*s out of here and store them for an extended time elsewhere, be sure to increment the reference count. On the D side, we have strong references, but that is incidental to the GC. If you stick d objects not allocated with the GC, there will probably be leaks. We use malloc for the container's structure because we can't use the GC inside a destructor and we need to use this container there.

Meta