diff options
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index f896f7c..a319c23 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -674,8 +674,9 @@ inline_comprehension(PySTEntryObject *ste, PySTEntryObject *comp, } // free vars in comprehension that are locals in outer scope can - // now simply be locals, unless they are free in comp children - if (!is_free_in_any_child(comp, k)) { + // now simply be locals, unless they are free in comp children, + // or if the outer scope is a class block + if (!is_free_in_any_child(comp, k) && ste->ste_type != ClassBlock) { if (PySet_Discard(comp_free, k) < 0) { return 0; } |