Skip to content

Commit 4ffadb4

Browse files
committed
Extension modules created from PyModule_Create() can share state
1 parent ad0a8a9 commit 4ffadb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Python/import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,9 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name,
441441
return -1;
442442
}
443443

444-
if (_Py_IsMainInterpreter(tstate->interp)) {
444+
// bpo-44050: Extensions and def->m_base.m_copy can be updated
445+
// when extension module created from PyModule_Create().
446+
if (_Py_IsMainInterpreter(tstate->interp) || def->m_slots == NULL) {
445447
if (def->m_size == -1) {
446448
if (def->m_base.m_copy) {
447449
/* Somebody already imported the module,

0 commit comments

Comments
 (0)