diff options
author | Hai Shi <shihai1992@gmail.com> | 2021-10-05 13:19:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 13:19:32 (GMT) |
commit | b9bb74871b27d9226df2dd3fce9d42bda8b43c2b (patch) | |
tree | 09af0bf4e5971a4ccaa0eec5a1060212e8fce2bc /Python | |
parent | 5146877623ebe8a2806411703b0de9c0aba179a1 (diff) | |
download | cpython-b9bb74871b27d9226df2dd3fce9d42bda8b43c2b.zip cpython-b9bb74871b27d9226df2dd3fce9d42bda8b43c2b.tar.gz cpython-b9bb74871b27d9226df2dd3fce9d42bda8b43c2b.tar.bz2 |
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794)
Automerge-Triggered-By: GH:encukou
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index 317a836..d7f1267 100644 --- a/Python/import.c +++ b/Python/import.c @@ -442,7 +442,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 the extension module doesn't support sub-interpreters. + if (_Py_IsMainInterpreter(tstate->interp) || def->m_size == -1) { if (def->m_size == -1) { if (def->m_base.m_copy) { /* Somebody already imported the module, |