-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-135447: Document NOT_TAKEN
& POP_ITER
bytecode instructions
#135803
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
94bf17a
Document BUILD_TEMPLATE
Yzi-Li 43f3a54
Add newline
Yzi-Li 528ca6f
Document BUILD_INTERPOLATION
Yzi-Li f1c4585
Use it
Yzi-Li 7bb0dc5
Document NOT_TAKEN
Yzi-Li bdd8855
Delete refs
Yzi-Li ce4ffa6
Fix according to bytecodes.c
Yzi-Li 2a05bc6
Fix lint
Yzi-Li c88907c
Fix a small error
Yzi-Li 265a88a
Update Doc/library/dis.rst
Yzi-Li 2ddfa8e
Document BUILD_TEMPLATE
Yzi-Li 0352fe3
Add newline
Yzi-Li d54d487
Document BUILD_INTERPOLATION
Yzi-Li 30b8007
Use it
Yzi-Li 7e53639
Document NOT_TAKEN
Yzi-Li c51e87d
Delete refs
Yzi-Li 1d79895
Fix according to bytecodes.c
Yzi-Li e279660
Fix lint
Yzi-Li 572b3a0
Fix a small error
Yzi-Li 52cef36
Merge branch 'main' into fix-issue-135447
Yzi-Li a5f4482
Fix conflict
Yzi-Li a1ee14c
Add POP_ITER
Yzi-Li 0550bd2
Merge branch 'main' into fix-issue-135447
AA-Turner 542aaa4
Merge branch 'main' into fix-issue-135447
AA-Turner cabee26
Remove duplicate BUILD_INTERPOLATION/BUILD_TEMPLATE; clarify NOT_TAKE…
AA-Turner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -585,6 +585,12 @@ operations on it as if it was a Python list. The top of the stack corresponds to | |
generate line tracing events. | ||
|
||
|
||
.. opcode:: NOT_TAKEN | ||
Do nothing code. Used as a hint to the interpreter that a branch was predicted | ||
as not taken. | ||
.. versionadded:: 3.14 | ||
|
||
|
||
.. opcode:: POP_TOP | ||
|
||
Removes the top-of-stack item:: | ||
|
@@ -1163,6 +1169,27 @@ iterations of the loop. | |
.. versionadded:: 3.6 | ||
|
||
|
||
.. opcode:: BUILD_INTERPOLATION | ||
|
||
It expects as stack inputs (from top of stack down): | ||
|
||
* ``format``: ``STACK[oparg & 1]`` | ||
* ``str``: ``STACK[-1 - (oparg & 1)]`` | ||
* ``value``: ``STACK[-2 - (oparg & 1)]`` | ||
|
||
It outputs the interpolation object to ``STACK[-1]`` after consuming its inputs. | ||
|
||
.. versionadded:: 3.14 | ||
|
||
|
||
.. opcode:: BUILD_TEMPLATE | ||
|
||
It consumes ``STACK[-1]``(string) and ``STACK[-2]``(interpolations) and | ||
|
||
outputs the template object to ``STACK[-1]``. | ||
|
||
.. versionadded:: 3.14 | ||
|
||
|
||
.. opcode:: LIST_EXTEND (i) | ||
|
||
Implements:: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I forgot what
NOT_TAKEN
does, but the rest look good. Maybe @iritkatriel knows?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.
It indeed does nothing. Not sure it's related to prediction though. It think it's to give tracing applications like code coverage a way to distinguish between the taken/not taken branches.
CC @markshannon
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.
Can we consider its behavior to be the same as NOP?
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.
Yes its a NOP but I forgot if its a hint or not.