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) {
|
||||
classname = basename;
|
||||
}
|
||||
if (!ptr) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
PyObject* cap = PyCapsule_New(ptr, basename, NULL);
|
||||
if (!cap) {
|
||||
PyErr_SetString(PyExc_TypeError, "Error creating new PyCapsule");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue