[Python-checkins] python/dist/src/Lib/test test_scope.py, 1.28, 1.29

nascheme@users.sourceforge.net nascheme at users.sourceforge.net
Sun Oct 23 06:24:44 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28445/Lib/test

Modified Files:
	test_scope.py 
Log Message:
Fix arigo's funky LOAD_NAME bug: implicit globals inside classes have
historically been looked up using LOAD_NAME, not LOAD_GLOBAL.
looked up by LOAD_NAME, not


Index: test_scope.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- test_scope.py	20 Oct 2005 19:59:24 -0000	1.28
+++ test_scope.py	23 Oct 2005 04:24:39 -0000	1.29
@@ -440,6 +440,15 @@
 x = -1
 vereq(test(3)(2), 5)
 
+looked_up_by_load_name = False
+class X:
+    # Implicit globals inside classes are be looked up by LOAD_NAME, not
+    # LOAD_GLOBAL.
+    locals()['looked_up_by_load_name'] = True
+    passed = looked_up_by_load_name
+
+verify(X.passed)
+
 print "18. verify that locals() works"
 
 def f(x):



More information about the Python-checkins mailing list