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

Skip to content

Commit 7ce57d6

Browse files
committed
Issue #18426: improve exception message. Courtesy of Amaury
1 parent 848ee09 commit 7ce57d6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Python/importdl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp)
9797

9898
/* Remember pointer to module init function. */
9999
def = PyModule_GetDef(m);
100-
if (def == NULL)
100+
if (def == NULL) {
101+
PyErr_Format(PyExc_SystemError,
102+
"initialization of %s did not return an extension "
103+
"module", shortname);
101104
goto error;
105+
}
102106
def->m_base.m_init = p;
103107

104108
/* Remember the filename as the __file__ attribute */

0 commit comments

Comments
 (0)