diff options
author | Mark Shannon <mark@hotpy.org> | 2021-06-04 00:03:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 00:03:54 (GMT) |
commit | b2bf2bc1ece673d387341e06c8d3c2bc6e259747 (patch) | |
tree | 29217a2927ed27e71e6324876f279946219a25a9 /Objects/codeobject.c | |
parent | 35002aa8f62dda1f79035e9904abdf476683e9be (diff) | |
download | cpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.zip cpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.tar.gz cpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.tar.bz2 |
bpo-43693: Compute deref offsets in compiler (gh-25152)
Merges locals and cells into a single array.
Saves a pointer in the interpreter and means that we don't need the LOAD_CLOSURE opcode any more
https://bugs.python.org/issue43693
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 051aefe..b82a1b5 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1547,8 +1547,6 @@ error: code._varname_from_oparg oparg: int - * - cell: bool = False (internal-only) Return the local variable name for the given oparg. @@ -1556,12 +1554,9 @@ WARNING: this method is for internal use only and may change or go away. [clinic start generated code]*/ static PyObject * -code__varname_from_oparg_impl(PyCodeObject *self, int oparg, int cell) -/*[clinic end generated code: output=c7d39c9723692c8f input=2945bb291d3a3118]*/ +code__varname_from_oparg_impl(PyCodeObject *self, int oparg) +/*[clinic end generated code: output=1fd1130413184206 input=c5fa3ee9bac7d4ca]*/ { - if (cell) { - oparg += self->co_nlocals; - } PyObject *name = PyTuple_GetItem(self->co_localsplusnames, oparg); if (name == NULL) { return NULL; |