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
bpo-44511: Improve the bytecode for class and mapping patterns #26922
bpo-44511: Improve the bytecode for class and mapping patterns #26922
Conversation
|
Lib/opcode.py
Outdated
@@ -165,7 +165,7 @@ def jabs_op(name, op): | |||
def_op('IS_OP', 117) | |||
def_op('CONTAINS_OP', 118) | |||
def_op('RERAISE', 119) | |||
|
|||
def_op('PUSH_PEEK', 120) |
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.
All instructions push their result. Could you rename this to PEEK
, or COPY
.
I'd prefer COPY
.
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.
Yeah, I wanted to just go with PEEK
, but that conflicted with the PEEK
macro in ceval.c
.
I like COPY
much better.
Python/ceval.c
Outdated
@@ -4367,6 +4339,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag) | |||
DISPATCH(); | |||
} | |||
|
|||
case TARGET(PUSH_PEEK): { | |||
PyObject *peek = PEEK(oparg + 1); |
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'd prefer PEEK(oparg)
.
I realize that would make oparg == 0
invalid, but counting from one is the convention when determining stack positions.
with a :class:`dict` formed from the items of TOS1, but without any of the | ||
keys in TOS. | ||
|
||
.. versionadded:: 3.10 |
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.
Would it be possible to document bytecode changes in What's New in Python 3.11? There is a bytecode section:
https://docs.python.org/dev/whatsnew/3.11.html#cpython-bytecode-changes
Thanks for your reviews! I'll resolve the current conflicts. |
Looks good. |
https://bugs.python.org/issue44511