mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)
This commit is contained in:
parent
a3cf0fada0
commit
a8e93d3dca
8 changed files with 23 additions and 6 deletions
|
|
@ -1140,7 +1140,7 @@ frame_init_get_vars(_PyInterpreterFrame *frame)
|
|||
|
||||
/* Free vars have not been initialized -- Do that */
|
||||
PyObject *closure = ((PyFunctionObject *)frame->f_funcobj)->func_closure;
|
||||
int offset = PyCode_GetFirstFree(co);
|
||||
int offset = PyUnstable_Code_GetFirstFree(co);
|
||||
for (int i = 0; i < co->co_nfreevars; ++i) {
|
||||
PyObject *o = PyTuple_GET_ITEM(closure, i);
|
||||
frame->localsplus[offset + i] = Py_NewRef(o);
|
||||
|
|
|
|||
|
|
@ -10884,7 +10884,7 @@ super_init_without_args(_PyInterpreterFrame *cframe, PyCodeObject *co,
|
|||
|
||||
// Look for __class__ in the free vars.
|
||||
PyTypeObject *type = NULL;
|
||||
int i = PyCode_GetFirstFree(co);
|
||||
int i = PyUnstable_Code_GetFirstFree(co);
|
||||
for (; i < co->co_nlocalsplus; i++) {
|
||||
assert((_PyLocals_GetKind(co->co_localspluskinds, i) & CO_FAST_FREE) != 0);
|
||||
PyObject *name = PyTuple_GET_ITEM(co->co_localsplusnames, i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue