diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-10-05 16:34:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 16:34:59 (GMT) |
commit | d0d29655ffc43d426ad68542d8de8304f7f1346a (patch) | |
tree | a43da04dbe142c6c56eb5b6620855884c637fc4c /Python | |
parent | d0d0909a3a0b553826d1ddbb04a676fdabb61359 (diff) | |
download | cpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.zip cpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.tar.gz cpython-d0d29655ffc43d426ad68542d8de8304f7f1346a.tar.bz2 |
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794) (GH-28738)
Automerge-Triggered-By: GH:encukou
(cherry picked from commit b9bb74871b27d9226df2dd3fce9d42bda8b43c2b)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
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 f2b30af..50f4956 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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 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, |