gh-94936: C getters: co_varnames, co_cellvars, co_freevars (GH-95008)

(cherry picked from commit 42b102bbf9)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-08-04 07:16:52 -07:00 committed by GitHub
parent c521c5cdc3
commit f2926358d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 128 additions and 15 deletions

View file

@ -1399,18 +1399,36 @@ _PyCode_GetVarnames(PyCodeObject *co)
return get_localsplus_names(co, CO_FAST_LOCAL, co->co_nlocals);
}
PyObject *
PyCode_GetVarnames(PyCodeObject *code)
{
return _PyCode_GetVarnames(code);
}
PyObject *
_PyCode_GetCellvars(PyCodeObject *co)
{
return get_localsplus_names(co, CO_FAST_CELL, co->co_ncellvars);
}
PyObject *
PyCode_GetCellvars(PyCodeObject *code)
{
return _PyCode_GetCellvars(code);
}
PyObject *
_PyCode_GetFreevars(PyCodeObject *co)
{
return get_localsplus_names(co, CO_FAST_FREE, co->co_nfreevars);
}
PyObject *
PyCode_GetFreevars(PyCodeObject *code)
{
return _PyCode_GetFreevars(code);
}
static void
deopt_code(_Py_CODEUNIT *instructions, Py_ssize_t len)
{