]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport Jeremy's checkin 1.15:
authorThomas Wouters <thomas@python.org>
Wed, 23 May 2001 12:15:17 +0000 (12:15 +0000)
committerThomas Wouters <thomas@python.org>
Wed, 23 May 2001 12:15:17 +0000 (12:15 +0000)
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.

Lib/test/test_scope.py

index 358c45a0a127bda0ddc747ba814b15aa494a8f33..c42d881402bef1248b9f6451459cfb5cc2a0c019 100644 (file)
@@ -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())