mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Fix 2.1 nested scopes crash reported by Evan Simpson
The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug.
This commit is contained in:
parent
960d948e7c
commit
ddc4fd03b1
3 changed files with 32 additions and 6 deletions
|
|
@ -17,3 +17,4 @@ test_scope
|
|||
16. check leaks
|
||||
17. class and global
|
||||
18. verify that locals() works
|
||||
19. var is bound and free in class
|
||||
|
|
|
|||
|
|
@ -436,3 +436,14 @@ verify(d.has_key('h'))
|
|||
del d['h']
|
||||
verify(d == {'x': 2, 'y': 7, 'w': 6})
|
||||
|
||||
print "19. var is bound and free in class"
|
||||
|
||||
def f(x):
|
||||
class C:
|
||||
def m(self):
|
||||
return x
|
||||
a = x
|
||||
return C
|
||||
|
||||
inst = f(3)()
|
||||
verify(inst.a == inst.m())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue