You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python 3.12 inspecting a coroutine using getcoroutinestate returns the wrong state. #111058
changed the title [-]Python 3.12 cannot close a just created coroutine[/-][+]Python 3.12 inspecting a coroutine using `getcoroutinestate` returns the wrong state.[/+]on Oct 31, 2023
if coroutine.cr_running:
return CORO_RUNNING
if coroutine.cr_suspended:
return CORO_SUSPENDED
if coroutine.cr_frame is None:
return CORO_CLOSED
return CORO_CREATED
coroutine.cr_frame returns None for frames which have state FRAME_CLEARED, but not for FRAME_COMPLETED.
Activity
terryjreedy commentedon Oct 19, 2023
Same change on Windows. 3.13 like 3.12.
Eclips4 commentedon Oct 19, 2023
Bisected to f02fa64
cc @markshannon
[-]Python 3.12 cannot close a just created coroutine[/-][+]Python 3.12 inspecting a coroutine using `getcoroutinestate` returns the wrong state.[/+]markshannon commentedon Oct 31, 2023
The coroutine is closed, as
coro.send(None)fails. It is just thatgetcoroutinestatereturns the wrong value.I've updated the title accordingly.
iritkatriel commentedon Nov 26, 2023
getcoroutinestatedoes this:coroutine.cr_framereturnsNonefor frames which have stateFRAME_CLEARED, but not forFRAME_COMPLETED.pythongh-111058: Change coro.cr_frame to be None for a closed coroutine
pythongh-111058: Change coro.cr_frame to be None for a closed coroutine
gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed …
pythongh-111058: Change coro.cr_frame/gen.gi_frame to be None for a c…
Eclips4 commentedon Dec 1, 2023
Thanks @gottadiveintopython for the report and Irit for fixing it!
[3.12] gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a …
pythongh-111058: Change coro.cr_frame/gen.gi_frame to be None for a c…
pythongh-111058: Change coro.cr_frame/gen.gi_frame to be None for a c…