Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Extension modules created from PyModule_Create() can share state
  • Loading branch information
shihai1991 committed Aug 17, 2021
commit 4ffadb4430b6cda726473b72c98bcd7c3b35a17f
4 changes: 3 additions & 1 deletion Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name,
return -1;
}

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