mirror of
https://github.com/python/cpython.git
synced 2025-09-16 05:36:29 +00:00
GH-132554: Fix tier2 FOR_ITER
implementation and optimizations (GH-135137)
This commit is contained in:
parent
d9cad074d5
commit
b90ecea9e6
12 changed files with 155 additions and 173 deletions
|
@ -40,6 +40,7 @@ make_table_entry(PyObject *obj, const char *filename, int linenumber)
|
|||
PyObject *
|
||||
_Py_stackref_get_object(_PyStackRef ref)
|
||||
{
|
||||
assert(!PyStackRef_IsError(ref));
|
||||
if (ref.index == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -64,6 +65,7 @@ PyStackRef_Is(_PyStackRef a, _PyStackRef b)
|
|||
PyObject *
|
||||
_Py_stackref_close(_PyStackRef ref, const char *filename, int linenumber)
|
||||
{
|
||||
assert(!PyStackRef_IsError(ref));
|
||||
PyInterpreterState *interp = PyInterpreterState_Get();
|
||||
if (ref.index >= interp->next_stackref) {
|
||||
_Py_FatalErrorFormat(__func__, "Invalid StackRef with ID %" PRIu64 " at %s:%d\n", (void *)ref.index, filename, linenumber);
|
||||
|
@ -128,6 +130,7 @@ _Py_stackref_create(PyObject *obj, const char *filename, int linenumber)
|
|||
void
|
||||
_Py_stackref_record_borrow(_PyStackRef ref, const char *filename, int linenumber)
|
||||
{
|
||||
assert(!PyStackRef_IsError(ref));
|
||||
if (ref.index < INITIAL_STACKREF_INDEX) {
|
||||
return;
|
||||
}
|
||||
|
@ -152,6 +155,7 @@ _Py_stackref_record_borrow(_PyStackRef ref, const char *filename, int linenumber
|
|||
void
|
||||
_Py_stackref_associate(PyInterpreterState *interp, PyObject *obj, _PyStackRef ref)
|
||||
{
|
||||
assert(!PyStackRef_IsError(ref));
|
||||
assert(ref.index < INITIAL_STACKREF_INDEX);
|
||||
TableEntry *entry = make_table_entry(obj, "builtin-object", 0);
|
||||
if (entry == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue