mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-14 09:34:46 +00:00
7c6f2f80a7
* fix: PyCapsule_GetDestructor is allowed to return a nullptr destructor
Previously, this code would error out if the destructor happened to be
a nullptr. This is incorrect. nullptrs are allowed for capsule
destructors.
"It is legal for a capsule to have a NULL destructor. This makes a
NULL return code somewhat ambiguous; use PyCapsule_IsValid() or
PyErr_Occurred() to disambiguate."
See:
https://docs.python.org/3/c-api/capsule.html#c.PyCapsule_GetDestructor
I noticed this while working on a type caster related to #3858 DLPack
happens to allow the destructor not to be defined on a capsule, and I
encountered such a case. See:
|
||
---|---|---|
.. | ||
pybind11 |