Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
There is an unexpected SystemError which is completely outside of user code. I get it with Python 3.13.0 on Windows, but did never see it with Python 3.12.x:
Exception ignored on threading shutdown:Traceback (most recent call last): File "C:\Program Files\Python313\Lib\threading.py", line 1524, in _shutdown if _main_thread._handle.is_done() and _is_main_interpreter():SystemError: <method 'is_done' of '_thread._ThreadHandle' objects> returned a result with an exception setReproduction
The following minimal reproduction script:
importasyncioimportsysasyncdefrun():p=awaitasyncio.create_subprocess_exec(*["ssh","mek@192.168.37.128"])try:returnawaitp.wait()# leaving out "return" would helpfinally:ifp.returncodeisNone:# leaving out this "if" statement or the complete "finally" block also would helpp.terminate()sys.exit(asyncio.run(run()))
Run the it and leave the ssh session withsudo reboot now. You get the following output (note the last 5 lines):
mek@mek-ubuntu:~$ sudo reboot now[sudo] password for mek:Broadcast message from root@mek-ubuntu on pts/1 (Tue 2024-10-22 15:55:11 CEST):The system will reboot now!mek@mek-ubuntu:~$ Connection to 192.168.37.128 closed by remote host.Connection to 192.168.37.128 closed.Exception ignored on threading shutdown:Traceback (most recent call last): File "C:\Program Files\Python313\Lib\threading.py", line 1524, in _shutdown if _main_thread._handle.is_done() and _is_main_interpreter():SystemError: <method 'is_done' of '_thread._ThreadHandle' objects> returned a result with an exception setThere seems to be a strange interaction with async functions, local variables and return values:
- leaving out the "return" keyword at
return await p.wait()prevents the warning message - leaving out the "finally" block or just leave it empty with
passalso omits the warning message - exiting the SSH session with
exitalso omits the warning message
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done