From: Thomas Wouters Date: Wed, 23 May 2001 12:15:17 +0000 (+0000) Subject: Backport Jeremy's checkin 1.15: X-Git-Tag: v2.1.1c1~119 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77307359bf7b3548828a7e7735f544ca4f273d40;p=thirdparty%2FPython%2Fcpython.git Backport Jeremy's checkin 1.15: 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. --- diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index 358c45a0a127..c42d881402be 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -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())