pycapsule_new should return a None object if ptr is NULL.
This commit is contained in:
parent
af7962a2ca
commit
7aa9487f2f
1 changed files with 3 additions and 0 deletions
|
|
@ -23,6 +23,9 @@ PyObject* pycapsule_new(void* ptr,
|
||||||
if (!classname) {
|
if (!classname) {
|
||||||
classname = basename;
|
classname = basename;
|
||||||
}
|
}
|
||||||
|
if (!ptr) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
PyObject* cap = PyCapsule_New(ptr, basename, NULL);
|
PyObject* cap = PyCapsule_New(ptr, basename, NULL);
|
||||||
if (!cap) {
|
if (!cap) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Error creating new PyCapsule");
|
PyErr_SetString(PyExc_TypeError, "Error creating new PyCapsule");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue