mirror of
https://github.com/python/cpython.git
synced 2025-08-26 19:55:24 +00:00
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 b9bb74871b
)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
This commit is contained in:
parent
d0d0909a3a
commit
d0d29655ff
4 changed files with 59 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue