-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-120321: Add gi_state, cr_state, and ag_state attributes #144409
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
Changes from all commits
f3335d3
86c06fa
71a9532
be25720
59a219b
b7fb695
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,18 +44,16 @@ extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code); | |
| /* other API */ | ||
|
|
||
| typedef enum _framestate { | ||
| FRAME_CREATED = -4, | ||
| FRAME_SUSPENDED = -3, | ||
| FRAME_SUSPENDED_YIELD_FROM = -2, | ||
| FRAME_SUSPENDED_YIELD_FROM_LOCKED = -1, | ||
| FRAME_EXECUTING = 0, | ||
| FRAME_COMPLETED = 1, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget to mention FRAME_COMPLETED removal in the commit message. I'm fine with the removal, the constant was only used in one place: in FRAME_STATE_FINISHED().
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've edited the PR description and will use that when squash + merging. |
||
| FRAME_CLEARED = 4 | ||
| FRAME_CREATED = 0, | ||
| FRAME_SUSPENDED = 1, | ||
| FRAME_SUSPENDED_YIELD_FROM = 2, | ||
| FRAME_SUSPENDED_YIELD_FROM_LOCKED = 3, | ||
| FRAME_EXECUTING = 4, | ||
| FRAME_CLEARED = 5 | ||
| } PyFrameState; | ||
|
|
||
| #define FRAME_STATE_SUSPENDED(S) ((S) >= FRAME_SUSPENDED && (S) <= FRAME_SUSPENDED_YIELD_FROM_LOCKED) | ||
| #define FRAME_STATE_FINISHED(S) ((S) >= FRAME_COMPLETED) | ||
|
|
||
| #define FRAME_STATE_FINISHED(S) ((S) == FRAME_CLEARED) | ||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Add ``gi_state``, ``cr_state``, and ``ag_state`` attributes to generators, | ||
| coroutines, and async generators that return the current state as a string | ||
| (e.g., ``GEN_RUNNING``). The :mod:`inspect` module functions | ||
| :func:`~inspect.getgeneratorstate`, :func:`~inspect.getcoroutinestate`, and | ||
| :func:`~inspect.getasyncgenstate` now return these attributes directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a
.. versionchanged:: nextmarkup at the end of the table to mention that gi_state, ag_state, cr_state are added in Python 3.15.