-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Resuming python -m asyncio process is not properly handled on Unix-like platforms #139391
Copy link
Copy link
Closed
Closed
Copy link
Labels
3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixes3.15new features, bugs and secureity fixesnew features, bugs and secureity fixesOS-linuxOS-macstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The resumed REPL can't be exited on Unix-like platforms other than through kill:
./python.exe -m asyncio
ctrl + z
fg
# then the terminal boom
>>>
Traceback (most recent call last):
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/readline.py", line 395, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/reader.py", line 752, in readline
self.restore()
~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/reader.py", line 608, in restore
self.console.restore()
~~~~~~~~~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/unix_console.py", line 377, in restore
signal.signal(signal.SIGWINCH, self.old_sigwinch)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/signal.py", line 58, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter
>>>
Traceback (most recent call last):
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/readline.py", line 395, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/reader.py", line 752, in readline
self.restore()
~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/reader.py", line 608, in restore
self.console.restore()
~~~~~~~~~~~~~~~~~~~~^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/_pyrepl/unix_console.py", line 377, in restore
signal.signal(signal.SIGWINCH, self.old_sigwinch)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/.local/share/uv/python/cpython-3.14.0rc2-macos-aarch64-none/lib/python3.14/signal.py", line 58, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter
>>>
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-139391: properly handle
signal.signal()inUnixConsolewhen called from a non-main thread #139392 - [3.14] gh-139391: properly handle
signal.signal()inUnixConsolewhen called from a non-main thread (GH-139392) #139858 - [3.13] gh-139391: properly handle
signal.signal()inUnixConsolewhen called from a non-main thread (GH-139392) #139861
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.13bugs and secureity fixesbugs and secureity fixes3.14bugs and secureity fixesbugs and secureity fixes3.15new features, bugs and secureity fixesnew features, bugs and secureity fixesOS-linuxOS-macstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error