Skip to content

Commit 8234419

Browse files
gh-122562: Remove ste_free and ste_child_free from symtable (#122563)
1 parent df13a18 commit 8234419

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

Include/internal/pycore_symtable.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ typedef struct _symtable_entry {
106106
const char *ste_scope_info;
107107

108108
int ste_nested; /* true if block is nested */
109-
unsigned ste_free : 1; /* true if block has free variables */
110-
unsigned ste_child_free : 1; /* true if a child block has free vars,
111-
including free refs to globals */
112109
unsigned ste_generator : 1; /* true if namespace is a generator */
113110
unsigned ste_coroutine : 1; /* true if namespace is a coroutine */
114111
unsigned ste_annotations_used : 1; /* true if there are any annotations in this scope */

Python/symtable.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
115115
ste->ste_scope_info = NULL;
116116

117117
ste->ste_nested = 0;
118-
ste->ste_free = 0;
119118
ste->ste_varargs = 0;
120119
ste->ste_varkeywords = 0;
121120
ste->ste_annotations_used = 0;
@@ -125,7 +124,6 @@ ste_new(struct symtable *st, identifier name, _Py_block_ty block,
125124
(st->st_cur->ste_nested ||
126125
_PyST_IsFunctionLike(st->st_cur)))
127126
ste->ste_nested = 1;
128-
ste->ste_child_free = 0;
129127
ste->ste_generator = 0;
130128
ste->ste_coroutine = 0;
131129
ste->ste_comprehension = NoComprehension;
@@ -299,8 +297,6 @@ static void _dump_symtable(PySTEntryObject* ste, PyObject* prefix)
299297
comptype,
300298
prefix,
301299
ste->ste_nested ? " nested" : "",
302-
ste->ste_free ? " free" : "",
303-
ste->ste_child_free ? " child_free" : "",
304300
ste->ste_generator ? " generator" : "",
305301
ste->ste_coroutine ? " coroutine" : "",
306302
ste->ste_varargs ? " varargs" : "",
@@ -692,7 +688,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
692688
return error_at_directive(ste, name);
693689
}
694690
SET_SCOPE(scopes, name, FREE);
695-
ste->ste_free = 1;
696691
return PySet_Add(free, name) >= 0;
697692
}
698693
if (flags & DEF_BOUND) {
@@ -741,7 +736,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
741736
}
742737
if (contains) {
743738
SET_SCOPE(scopes, name, FREE);
744-
ste->ste_free = 1;
745739
return PySet_Add(free, name) >= 0;
746740
}
747741
}
@@ -758,8 +752,6 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags,
758752
return 1;
759753
}
760754
}
761-
if (ste->ste_nested)
762-
ste->ste_free = 1;
763755
SET_SCOPE(scopes, name, GLOBAL_IMPLICIT);
764756
return 1;
765757
}
@@ -842,7 +834,6 @@ inline_comprehension(PySTEntryObject *ste, PySTEntryObject *comp,
842834
}
843835
}
844836
}
845-
comp->ste_free = PySet_Size(comp_free) > 0;
846837
if (remove_dunder_class && PyDict_DelItemString(comp->ste_symbols, "__class__") < 0) {
847838
return 0;
848839
}
@@ -1202,9 +1193,6 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
12021193
if (!temp)
12031194
goto error;
12041195
Py_DECREF(temp);
1205-
/* Check if any children have free variables */
1206-
if (entry->ste_free || entry->ste_child_free)
1207-
ste->ste_child_free = 1;
12081196
}
12091197

12101198
/* Splice children of inlined comprehensions into our children list */

0 commit comments

Comments
 (0)