Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
[3.12] gh-112826: Fix the threading Module When _thread is Missing _is_main_interpreter()#112850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: T. Wouters <thomas@python.org>
gh-112853)As ofgh-112661, the threading module expects the _thread module to have a _is_main_interpreter(), which is used in the internal threading._shutdown(). This change causes a problem for anyone that replaces the _thread module with a custom one (only if they don't provide _is_main_interpreter()). They need to be sure to add it for 3.13+, thus this PR is adding a note in "What's New".This also forward-ports the "What's New" entry from 3.12 (gh-112850). Note that we do not also forward-port the fix in that PR. The fix is there only due to a regression from 3.12.0. There is no regression in 3.13+.
…rpreter (pythongh-112853)As ofpythongh-112661, the threading module expects the _thread module to have a _is_main_interpreter(), which is used in the internal threading._shutdown(). This change causes a problem for anyone that replaces the _thread module with a custom one (only if they don't provide _is_main_interpreter()). They need to be sure to add it for 3.13+, thus this PR is adding a note in "What's New".This also forward-ports the "What's New" entry from 3.12 (pythongh-112850). Note that we do not also forward-port the fix in that PR. The fix is there only due to a regression from 3.12.0. There is no regression in 3.13+.
…rpreter (pythongh-112853)As ofpythongh-112661, the threading module expects the _thread module to have a _is_main_interpreter(), which is used in the internal threading._shutdown(). This change causes a problem for anyone that replaces the _thread module with a custom one (only if they don't provide _is_main_interpreter()). They need to be sure to add it for 3.13+, thus this PR is adding a note in "What's New".This also forward-ports the "What's New" entry from 3.12 (pythongh-112850). Note that we do not also forward-port the fix in that PR. The fix is there only due to a regression from 3.12.0. There is no regression in 3.13+.
Uh oh!
There was an error while loading.Please reload this page.
_thread._is_main_interpreter()
was added (and aliased asthreading._is_main_interpreter()
) after the 3.12.0 release, ingh-110707 (a backport ofgh-112661). However, that change did not accommodate cases where users replace the_thread
module with a custom version that doesn't have_is_main_interpreter()
defined (e.g. gevent).This change fixes that by falling back to a dummy
_is_main_interpreter()
that always says "yes". That case is unlikely and the consequences of saying a subinterpreter is the main interpreter, relative to `threading._shutdown(), are almost zero.(We are fixing this in 3.12 only because it is a regression from the already released 3.12.0. In 3.13 (main) we will only have the note in "What's New".)
📚 Documentation preview 📚:https://cpython-previews--112850.org.readthedocs.build/