summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index b1aecec..25110b2 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -285,14 +285,16 @@ int
_PyState_AddModule(PyObject* module, struct PyModuleDef* def)
{
PyInterpreterState *state;
+ if (!def) {
+ assert(PyErr_Occurred());
+ return -1;
+ }
if (def->m_slots) {
PyErr_SetString(PyExc_SystemError,
"PyState_AddModule called on module with slots");
return -1;
}
state = GET_INTERP_STATE();
- if (!def)
- return -1;
if (!state->modules_by_index) {
state->modules_by_index = PyList_New(0);
if (!state->modules_by_index)