[Python-checkins] python/dist/src/Lib/test test_peepholer.py, 1.3, 1.4

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Oct 26 10:59:16 CEST 2004


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

Modified Files:
	test_peepholer.py 
Log Message:
SF bug #1053819:  Segfault in tuple_of_constants

Peepholer could be fooled into misidentifying a tuple_of_constants.
Added code to count consecutive occurrences of LOAD_CONST.
Use the count to weed out the misidentified cases.
Added a unittest.



Index: test_peepholer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_peepholer.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_peepholer.py	22 Sep 2004 18:44:08 -0000	1.3
+++ test_peepholer.py	26 Oct 2004 08:59:14 -0000	1.4
@@ -83,6 +83,23 @@
             self.assert_(elem in asm)
             self.assert_('BUILD_TUPLE' not in asm)
 
+        # Bug 1053819:  Tuple of constants misidentified when presented with:
+        # . . . opcode_with_arg 100   unary_opcode   BUILD_TUPLE 1  . . .
+        # The following would segfault upon compilation
+        def crater():
+            (~[
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+            ],)
+
     def test_elim_extra_return(self):
         # RETURN LOAD_CONST None RETURN  -->  RETURN
         def f(x):



More information about the Python-checkins mailing list