-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
asyncio.run unnecessarily calls the repr of the task result twice since Python 3.11 #112559
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
Comments
copybara-service bot
pushed a commit
to jax-ml/jax
that referenced
this issue
Nov 30, 2023
… of a coroutine as integer while fetching sigint handler. This makes the test materialize the whole tensor in memory. This changes the test co-routine to return nothing to avoid triggering this bug. python/cpython#112559 PiperOrigin-RevId: 586545760
copybara-service bot
pushed a commit
to jax-ml/jax
that referenced
this issue
Nov 30, 2023
… of a coroutine as integer while fetching sigint handler. This makes the test materialize the whole tensor in memory. This changes the test co-routine to return nothing to avoid triggering this bug. python/cpython#112559 PiperOrigin-RevId: 586756112
Thanks for the very thorough bug report. I am asking @kumaraditya303 to help out. Maybe @ethanfurman can also shed some light on this, since it looks like you are proposing a fix to the enum module. |
Thanks for the response! I'm proposing a change in signal.py module's private function here: Line 24 in 5b06299
|
@yilei Could you just submit a PR for that? |
yilei
added a commit
to yilei/cpython
that referenced
this issue
Dec 13, 2023
gvanrossum
pushed a commit
that referenced
this issue
Dec 24, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Dec 24, 2023
…in signal.py (pythonGH-113040) (cherry picked from commit 050783c) Co-authored-by: Yilei Yang <yileiyang@google.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Dec 24, 2023
…in signal.py (pythonGH-113040) (cherry picked from commit 050783c) Co-authored-by: Yilei Yang <yileiyang@google.com>
gvanrossum
pushed a commit
that referenced
this issue
Dec 24, 2023
gvanrossum
pushed a commit
that referenced
this issue
Dec 24, 2023
ryan-duve
pushed a commit
to ryan-duve/cpython
that referenced
this issue
Dec 26, 2023
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this issue
Jan 22, 2024
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this issue
Sep 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
Given the following code:
Output:
This was caused by the new SIGINT handler installed by asyncio.run here: f08a191
Upon investigation, changing the code with:
It shows:
This looks like a series unfortunate events, running on 3.12.0:
cpython/Lib/signal.py
Line 29 in 0fb18b0
cpython/Lib/enum.py
Line 1152 in 0fb18b0
cpython/Lib/asyncio/runners.py
Line 105 in 0fb18b0
signal.getsignal
, the other insignal.signal
), the repr of the asyncio task will include the repr of the result:cpython/Lib/asyncio/runners.py
Lines 127 to 129 in 0fb18b0
While one can argument calling
__repr__
shouldn't cause issues, but I think we could avoid them in thesignal._int_to_enum
function completely, by only trying to convert to enum when it's an integer:This should be more efficient on its own anyway.
This function's doc is also inaccurate, since it also accepts non integers (usually a callable).
Am I missing something?
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: