summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-09-14 22:42:39 (GMT)
committerGitHub <noreply@github.com>2023-09-14 22:42:39 (GMT)
commit35c633d245a947b2002b5c033ea46e31aec7d95c (patch)
treebeae7b4a54bde14a0d1555956d1106315cb2a233 /Python/symtable.c
parent52a9c5760c600bc96df87bc93641df504d302314 (diff)
downloadcpython-35c633d245a947b2002b5c033ea46e31aec7d95c.zip
cpython-35c633d245a947b2002b5c033ea46e31aec7d95c.tar.gz
cpython-35c633d245a947b2002b5c033ea46e31aec7d95c.tar.bz2
[3.12] gh-109219: propagate free vars through type param scopes (GH-109377) (#109410)
gh-109219: propagate free vars through type param scopes (GH-109377) (cherry picked from commit 909adb5092c0ae9426814742d97932204b211cfb) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 691698e..4989e03 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -801,8 +801,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) {
@@ -1037,7 +1036,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);