Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105716 breaks greenlet/eventlet #112826

Closed
doko42 opened this issue Dec 7, 2023 · 5 comments
Closed

gh-105716 breaks greenlet/eventlet #112826

doko42 opened this issue Dec 7, 2023 · 5 comments
Assignees
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes release-blocker topic-subinterpreters type-bug An unexpected behavior, bug, or error

Comments

@doko42
Copy link
Member

doko42 commented Dec 7, 2023

Bug report

Bug description:

gh-105716 breaks greenlet/eventlet, which apparently was working with the 3.12.0 release.
this is greenlet 3.0.1, plus eventlet 0.33.3 plus the python3.12 for eventlet taken from
https://src.fedoraproject.org/rpms/python-eventlet/tree/rawhide

Traceback (most recent call last):
  File "/home/packages/12/python-eventlet-0.33.3/tests/isolated/patcher_existing_locks_late.py", line 20, in <module>
    eventlet.monkey_patch()
  File "/home/packages/12/python-eventlet-0.33.3/eventlet/patcher.py", line 294, in monkey_patch
    modules_to_patch += modules_function()
                        ^^^^^^^^^^^^^^^^^^
  File "/home/packages/12/python-eventlet-0.33.3/eventlet/patcher.py", line 480, in _green_thread_modules
    from eventlet.green import threading
  File "/home/packages/12/python-eventlet-0.33.3/eventlet/green/threading.py", line 22, in <module>
    eventlet.patcher.inject(
  File "/home/packages/12/python-eventlet-0.33.3/eventlet/patcher.py", line 109, in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/threading.py", line 40, in <module>
    _is_main_interpreter = _thread._is_main_interpreter
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'eventlet.green.thread' has no attribute '_is_main_interpreter'

---
FAIL

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

@ericsnowcurrently
Copy link
Member

Thanks for bringing this to my attention. I'll take a look.

@ericsnowcurrently
Copy link
Member

FTR:

original PR: gh-112661
3.12 backport: gh-110707

@ericsnowcurrently
Copy link
Member

@Yhg1s, should this block 3.12.1? I expect to have a fix up shortly.

@ericsnowcurrently
Copy link
Member

To be clear, I am not planning on any actual fix in main (3.13+). There will only be a "What's New" entry. If an app or library is replacing the _thread module then they already know they need to provide everything the stdlib module does, including the "private" attributes (especially those used by threading). This seems like a fairly rare case so I'm okay with helping any such libraries with their fixes.

(The situation is different for 3.12, where 3.12.0 was already released and the change in gh-110707 introduced a regression. Thus a fix was needed for 3.12.1.)

In addition to the 3.12 fix, I'm planning on making sure gevent/eventlet gets fixed upstream.

Yhg1s pushed a commit that referenced this issue Dec 7, 2023
…s_main_interpreter() (#112850)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
ericsnowcurrently added a commit that referenced this issue Dec 7, 2023
gh-112853)

As of gh-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+.
@Eclips4
Copy link
Member

Eclips4 commented Dec 8, 2023

Thanks for the fix Eric!

@Eclips4 Eclips4 closed this as completed Dec 8, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Subinterpreters Dec 8, 2023
4383 added a commit to 4383/eventlet that referenced this issue Dec 18, 2023
python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix eventlet#838
Fix eventlet#604
4383 added a commit to 4383/eventlet that referenced this issue Dec 18, 2023
python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix eventlet#838
Fix eventlet#604
4383 added a commit to 4383/eventlet that referenced this issue Dec 18, 2023
python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix eventlet#838
Fix eventlet#604
4383 added a commit to 4383/eventlet that referenced this issue Dec 19, 2023
python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix eventlet#838
Fix eventlet#604
4383 added a commit to 4383/eventlet that referenced this issue Dec 19, 2023
python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix eventlet#838
Fix eventlet#604
4383 added a commit to eventlet/eventlet that referenced this issue Dec 19, 2023
…er' (#847)

python/cpython#112826

Python 3.13 doesn't have workaround and so eventlet is broken
with Python versions higher than 3.12.

Fix #838
Fix #604
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…rpreter (pythongh-112853)

As of pythongh-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+.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…rpreter (pythongh-112853)

As of pythongh-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+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes release-blocker topic-subinterpreters type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

4 participants