FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and frame state by iritkatriel · Pull Request #111648 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (4) .h  (6) .py  (3) .rst  (3) All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
3 changes: 2 additions & 1 deletion Doc/library/dis.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,8 @@ iterations of the loop.
oparg set to be the exception block depth, for efficient closing of generators.

.. versionchanged:: 3.13
this opcode no longer has an oparg
oparg is ``1`` if this instruction is part of a yield-from or await, and ``0``
otherwise.

.. opcode:: SETUP_ANNOTATIONS

Expand Down
3 changes: 2 additions & 1 deletion Doc/whatsnew/3.13.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,8 @@ Others
CPython bytecode changes
========================

* ``YIELD_VALUE`` no longer has an oparg. The oparg of ``RESUME`` was
* The oparg of ``YIELD_VALUE`` is now ``1`` if the yield is part of a
yield-from or await, and ``0`` otherwise. The oparg of ``RESUME`` was
changed to add a bit indicating whether the except-depth is 1, which
is needed to optimize closing of generators.
(Contributed by Irit Katriel in :gh:`111354`.)
Expand Down
7 changes: 5 additions & 2 deletions Include/internal/pycore_frame.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code);
/* other API */

typedef enum _framestate {
FRAME_CREATED = -2,
FRAME_SUSPENDED = -1,
FRAME_CREATED = -3,
FRAME_SUSPENDED = -2,
FRAME_SUSPENDED_YIELD_FROM = -1,
FRAME_EXECUTING = 0,
FRAME_COMPLETED = 1,
FRAME_CLEARED = 4
} PyFrameState;

#define FRAME_STATE_SUSPENDED(S) ((S) == FRAME_SUSPENDED || (S) == FRAME_SUSPENDED_YIELD_FROM)

enum _frameowner {
FRAME_OWNED_BY_THREAD = 0,
FRAME_OWNED_BY_GENERATOR = 1,
Expand Down
6 changes: 3 additions & 3 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 75 additions & 75 deletions Include/opcode_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

150 changes: 75 additions & 75 deletions Lib/_opcode_metadata.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

Back | FazBrowse Home | New Git URL