This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients corona10, eric.snow, erlendaasland, lukasz.langa, shihai1991, trygveaa, vstinner
Date 2021-05-25.10:15:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1621937729.48.0.740684129882.issue44050@roundup.psfhosted.org>
In-reply-to
Content
> The commit that fixes the issue in 3.10 is https://github.com/python/cpython/commit/7f1305ef9ea7234e1a5aacbea17490232e9b7dc2

Right, the _ssl module was ported to multiphase initialization (PEP 489) in bpo-42333 (fixed in Python 3.10.0a3).


> This is a regression in 3.9. It didn't happen in 3.8. The commit that introduced the issue is https://github.com/python/cpython/commit/82c83bd907409c287a5bd0d0f4598f2c0538f34d

In Python 3.9, some stdlib modules are still using the legacy API to initialize modules, and share states between interpreters. This is bad: no Python object (nor state) must be shared between two interpreters.

Well, there is an on-going work on subinterpreters:

* https://pyfound.blogspot.com/2021/05/the-2021-python-language-summit_16.html
* https://vstinner.github.io/isolate-subinterpreters.html

For example, many C extensions are being converted to the multiphase initialization API and get a "module state".

The _PyImport_FixupExtensionObject() change impacts extensions using the legacy API and so should not be used in subinterpreters.

Maybe the old behavior was better: if an extension uses the old API, share its state between all interpreters.
History
Date User Action Args
2021-05-25 10:15:29vstinnersetrecipients: + vstinner, lukasz.langa, eric.snow, corona10, shihai1991, erlendaasland, trygveaa
2021-05-25 10:15:29vstinnersetmessageid: <1621937729.48.0.740684129882.issue44050@roundup.psfhosted.org>
2021-05-25 10:15:29vstinnerlinkissue44050 messages
2021-05-25 10:15:28vstinnercreate