summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2006-07-09 16:16:34 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2006-07-09 16:16:34 (GMT)
commit0e07b60a4e44129cfafaeacac765cf957e2ea219 (patch)
treebf67b1a4f4302118d38e3c57ddd91f20da8b1d99 /Lib/test
parent63597f129d73ddcfc2f3adc99d0d84d1da91082e (diff)
downloadcpython-0e07b60a4e44129cfafaeacac765cf957e2ea219.zip
cpython-0e07b60a4e44129cfafaeacac765cf957e2ea219.tar.gz
cpython-0e07b60a4e44129cfafaeacac765cf957e2ea219.tar.bz2
Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ast.py2
-rw-r--r--Lib/test/test_scope.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index c64ad28..14fc010 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -160,7 +160,7 @@ exec_results = [
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, []), [('Return', (1, 8), ('Num', (1, 15), 1))], [])]),
('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]),
('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Num', (1, 4), 1))]),
-('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Load',)), ('Add',), ('Num', (1, 5), 1))]),
+('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Num', (1, 5), 1))]),
('Module', [('Print', (1, 0), ('Name', (1, 8), 'f', ('Load',)), [('Num', (1, 11), 1)], False)]),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]),
('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]),
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index f37254c..239745c 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -299,6 +299,17 @@ except NameError:
else:
raise TestFailed
+# test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation
+global_x = 1
+def f():
+ global_x += 1
+try:
+ f()
+except UnboundLocalError:
+ pass
+else:
+ raise TestFailed, 'scope of global_x not correctly determined'
+
print "14. complex definitions"
def makeReturner(*lst):