gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)

This commit is contained in:
Bogdan Romanyuk 2024-03-19 12:20:38 +03:00 committed by GitHub
parent a3cf0fada0
commit a8e93d3dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 23 additions and 6 deletions

View file

@ -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);