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

Skip to content

Commit e75996a

Browse files
committed
Issue #19437: Fix PyCFuncPtrType constructor, handle
_ctypes_alloc_format_string() failure
1 parent a215002 commit e75996a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,10 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
22452245
argtypes would be a ctypes type).
22462246
*/
22472247
stgdict->format = _ctypes_alloc_format_string(NULL, "X{}");
2248+
if (stgdict->format == NULL) {
2249+
Py_DECREF((PyObject *)stgdict);
2250+
return NULL;
2251+
}
22482252
stgdict->flags |= TYPEFLAG_ISPOINTER;
22492253

22502254
/* create the new instance (which is a class,

0 commit comments

Comments
 (0)