diff options
author | Carl Meyer <carl@oddbird.net> | 2023-09-14 16:20:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 16:20:32 (GMT) |
commit | 909adb5092c0ae9426814742d97932204b211cfb (patch) | |
tree | b9e6c45113475b3c96567d21c18136505283a81d /Python/symtable.c | |
parent | 4a54074a0f5579d417445ec28427cd0ed5aa01f4 (diff) | |
download | cpython-909adb5092c0ae9426814742d97932204b211cfb.zip cpython-909adb5092c0ae9426814742d97932204b211cfb.tar.gz cpython-909adb5092c0ae9426814742d97932204b211cfb.tar.bz2 |
gh-109219: propagate free vars through type param scopes (#109377)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index d737c09..b0c7240 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -836,8 +836,7 @@ update_symbols(PyObject *symbols, PyObject *scopes, the class that has the same name as a local or global in the class scope. */ - if (classflag && - PyLong_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) { + if (classflag) { long flags = PyLong_AS_LONG(v) | DEF_FREE_CLASS; v_new = PyLong_FromLong(flags); if (!v_new) { @@ -1078,7 +1077,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, goto error; /* Records the results of the analysis in the symbol table entry */ if (!update_symbols(ste->ste_symbols, scopes, bound, newfree, inlined_cells, - ste->ste_type == ClassBlock)) + (ste->ste_type == ClassBlock) || ste->ste_can_see_class_scope)) goto error; temp = PyNumber_InPlaceOr(free, newfree); |