summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_scope.py
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2005-10-23 04:24:49 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2005-10-23 04:24:49 (GMT)
commitd403c453869f04ab68154dd448f2473e5fed9dca (patch)
tree102c74572858ba8865ffe30cfb33c493122403d4 /Lib/test/test_scope.py
parentac699efad8ec4967db47d719df29b2f30cc5ee54 (diff)
downloadcpython-d403c453869f04ab68154dd448f2473e5fed9dca.zip
cpython-d403c453869f04ab68154dd448f2473e5fed9dca.tar.gz
cpython-d403c453869f04ab68154dd448f2473e5fed9dca.tar.bz2
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
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r--Lib/test/test_scope.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index 34801bd..f37254c 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -440,6 +440,15 @@ vereq(test(6)(2), 8)
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):