Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a9c7ad6

Browse filesBrowse files
Add some asserts to _PyImport_RunModInitFunc().
1 parent f07f32f commit a9c7ad6
Copy full SHA for a9c7ad6

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎Python/importdl.c

Copy file name to clipboardExpand all lines: Python/importdl.c
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ _PyImport_RunModInitFunc(PyModInitFunction p0,
278278

279279
res.def = PyModule_GetDef(m);
280280
if (res.def == NULL) {
281+
PyErr_Clear();
281282
PyErr_Format(PyExc_SystemError,
282283
"initialization of %s did not return an extension "
283284
"module", name_buf);
@@ -288,10 +289,12 @@ _PyImport_RunModInitFunc(PyModInitFunction p0,
288289
res.def->m_base.m_init = p0;
289290
}
290291

292+
assert(!PyErr_Occurred());
291293
*p_res = res;
292294
return 0;
293295

294296
error:
297+
assert(PyErr_Occurred());
295298
Py_CLEAR(res.module);
296299
res.def = NULL;
297300
*p_res = res;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.