Skip to content

Commit 0f6b7b7

Browse files
committed
Set error if initfunc is NULL
1 parent c4f1cc8 commit 0f6b7b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Python/import.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,11 @@ PyObject*
24472447
PyImport_CreateModuleFromInitfunc(
24482448
PyObject *spec, PyObject* (*initfunc)(void))
24492449
{
2450+
if (initfunc == NULL) {
2451+
PyErr_BadInternalCall();
2452+
return NULL;
2453+
}
2454+
24502455
PyThreadState *tstate = _PyThreadState_GET();
24512456

24522457
PyObject *name = PyObject_GetAttr(spec, &_Py_ID(name));

0 commit comments

Comments
 (0)