]> granicus.if.org Git - python/commitdiff
Fix problem handling EXTENDED_ARGs from SF bug # 1333982
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 24 Oct 2005 00:08:10 +0000 (00:08 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 24 Oct 2005 00:08:10 +0000 (00:08 +0000)
Lib/test/test_compile.py

index c567fa432abb6efafc3c6463a94c003819296063..93a2fb588d1ff40753b88dd3ae527b52a71da9b5 100644 (file)
@@ -101,6 +101,29 @@ class TestSpecifics(unittest.TestCase):
         exec 'z = a' in g, d
         self.assertEqual(d['z'], 12)
 
+    def test_extended_arg(self):
+        longexpr = 'x = x or ' + '-x' * 2500
+        code = '''
+def f(x):
+    %s
+    %s
+    %s
+    %s
+    %s
+    %s
+    %s
+    %s
+    %s
+    %s
+    # the expressions above have no effect, x == argument
+    while x:
+        x -= 1
+        # EXTENDED_ARG/JUMP_ABSOLUTE here
+    return x
+''' % ((longexpr,)*10)
+        exec code
+        self.assertEqual(f(5), 0)
+
     def test_complex_args(self):
 
         def comp_args((a, b)):