Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 588544d

Browse files
committed
Issue #19437: Fix GetKeepedObjects() of ctypes, handle PyCData_GetContainer()
failure
1 parent 7184366 commit 588544d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,11 @@ PyCData_GetContainer(CDataObject *self)
23442344
static PyObject *
23452345
GetKeepedObjects(CDataObject *target)
23462346
{
2347-
return PyCData_GetContainer(target)->b_objects;
2347+
CDataObject *container;
2348+
container = PyCData_GetContainer(target);
2349+
if (container == NULL)
2350+
return NULL;
2351+
return container->b_objects;
23482352
}
23492353

23502354
static PyObject *

0 commit comments

Comments
 (0)