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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user