Skip to content

Commit 1c46317

Browse files
Fail unsupported extensions.
1 parent 4e240a7 commit 1c46317

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Objects/moduleobject.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,14 @@ PyModule_FromDefAndSpec2(PyModuleDef* def, PyObject *spec, int module_api_versio
323323
goto error;
324324
}
325325
}
326-
// XXX Do a similar check once we have PyInterpreterState.ceval.own_gil.
326+
// XXX This case needs a test.
327+
else if (multiple_interpreters != Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
328+
&& interp->ceval.own_gil
329+
&& !_Py_IsMainInterpreter(interp)
330+
&& _PyImport_CheckSubinterpIncompatibleExtensionAllowed(name) < 0)
331+
{
332+
goto error;
333+
}
327334

328335
if (create) {
329336
m = create(spec, def);

0 commit comments

Comments
 (0)