Used as a std::shared_ptr deleter (second argument) to overload delete ptr with Py_DECREF(ptr).
More...
#include <util.h>
Public Member Functions | |
| pyobject_deleter (PyObject *pyobj) | |
Creates a pyobject_deleter and calls Py_INCREF(ptr). | |
| void | operator() (T const *p) |
Called by std::shared_ptr when its reference count reaches zero. | |
Used as a std::shared_ptr deleter (second argument) to overload delete ptr with Py_DECREF(ptr).
This allows data to be shared between C++ and Python that will be deleted when both reference counts reach zero.
The effective reference count is a lexicographical tuple of (Python reference count, C++ reference count), where the Python reference count is the most significant digit. A single Python reference count is held for all C++ references to the object.
See also
|
inline |
Creates a pyobject_deleter and calls Py_INCREF(ptr).
|
inline |
Called by std::shared_ptr when its reference count reaches zero.