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

Skip to content

Commit f8d59d2

Browse files
committed
Patch #828384: Don't discard nested exception in AddObject.
1 parent 7883dc8 commit f8d59d2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Python/modsupport.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,9 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
520520
return -1;
521521
}
522522
if (!o) {
523-
PyErr_SetString(PyExc_TypeError,
524-
"PyModule_AddObject() needs non-NULL value");
523+
if (!PyErr_Occurred())
524+
PyErr_SetString(PyExc_TypeError,
525+
"PyModule_AddObject() needs non-NULL value");
525526
return -1;
526527
}
527528

0 commit comments

Comments
 (0)