Skip to content

Commit

Permalink
pythongh-122562: Remove ste_free and ste_child_free from symtable
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Aug 1, 2024
1 parent fda6bd8 commit 209bb4c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions Include/internal/pycore_symtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ typedef struct _symtable_entry {
const char *ste_scope_info;

int ste_nested; /* true if block is nested */
unsigned ste_free : 1; /* true if block has free variables */
unsigned ste_child_free : 1; /* true if a child block has free vars,
including free refs to globals */
unsigned ste_generator : 1; /* true if namespace is a generator */
unsigned ste_coroutine : 1; /* true if namespace is a coroutine */
unsigned ste_annotations_used : 1; /* true if there are any annotations in this scope */
Expand Down
12 changes: 0 additions & 12 deletions Python/symtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
ste->ste_scope_info = NULL;

ste->ste_nested = 0;
ste->ste_free = 0;
ste->ste_varargs = 0;
ste->ste_varkeywords = 0;
ste->ste_annotations_used = 0;
Expand All @@ -125,7 +124,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
(st->st_cur->ste_nested ||
_PyST_IsFunctionLike(st->st_cur)))
ste->ste_nested = 1;
ste->ste_child_free = 0;
ste->ste_generator = 0;
ste->ste_coroutine = 0;
ste->ste_comprehension = NoComprehension;
Expand Down Expand Up @@ -299,8 +297,6 @@ static void _dump_symtable(PySTEntryObject* ste, PyObject* prefix)
comptype,
prefix,
ste->ste_nested ? " nested" : "",
ste->ste_free ? " free" : "",
ste->ste_child_free ? " child_free" : "",
ste->ste_generator ? " generator" : "",
ste->ste_coroutine ? " coroutine" : "",
ste->ste_varargs ? " varargs" : "",
Expand Down Expand Up @@ -692,7 +688,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
return error_at_directive(ste, name);
}
SET_SCOPE(scopes, name, FREE);
ste->ste_free = 1;
return PySet_Add(free, name) >= 0;
}
if (flags & DEF_BOUND) {
Expand Down Expand Up @@ -741,7 +736,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
}
if (contains) {
SET_SCOPE(scopes, name, FREE);
ste->ste_free = 1;
return PySet_Add(free, name) >= 0;
}
}
Expand All @@ -758,8 +752,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
return 1;
}
}
if (ste->ste_nested)
ste->ste_free = 1;
SET_SCOPE(scopes, name, GLOBAL_IMPLICIT);
return 1;
}
Expand Down Expand Up @@ -842,7 +834,6 @@ inline_comprehension(PySTEntryObject *ste, PySTEntryObject *comp,
}
}
}
comp->ste_free = PySet_Size(comp_free) > 0;
if (remove_dunder_class && PyDict_DelItemString(comp->ste_symbols, "__class__") < 0) {
return 0;
}
Expand Down Expand Up @@ -1202,9 +1193,6 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
if (!temp)
goto error;
Py_DECREF(temp);
/* Check if any children have free variables */
if (entry->ste_free || entry->ste_child_free)
ste->ste_child_free = 1;
}

/* Splice children of inlined comprehensions into our children list */
Expand Down

0 comments on commit 209bb4c

Please sign in to comment.