[Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.14,1.14.2.1

Thomas Wouters twouters@users.sourceforge.net
Wed, 23 May 2001 05:15:19 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv25199/Lib/test

Modified Files:
      Tag: release21-maint
	test_scope.py 
Log Message:

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.



Index: test_scope.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -r1.14 -r1.14.2.1
*** test_scope.py	2001/04/13 16:51:46	1.14
--- test_scope.py	2001/05/23 12:15:17	1.14.2.1
***************
*** 437,438 ****
--- 437,449 ----
  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())