Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SystemError: <method 'is_done' of '_thread._ThreadHandle' objects> returned a result with an exception set #125842

Closed
@kunom

Description

@kunom

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 set

Reproduction

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 set

There seems to be a strange interaction with async functions, local variables and return values:

  • leaving out the "return" keyword atreturn await p.wait() prevents the warning message
  • leaving out the "finally" block or just leave it empty withpass also omits the warning message
  • exiting the SSH session withexit also omits the warning message

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp