diff options
author | Raymond Hettinger <python@rcn.com> | 2004-10-26 08:59:14 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-10-26 08:59:14 (GMT) |
commit | 23109ef11e91c49b56b517ce454bcf87a4153c62 (patch) | |
tree | 53ca2774bc93c604957f33c6229b7b240dcf7532 /Lib | |
parent | 368c0b22f8e43709afbbc3805f55ceffed127212 (diff) | |
download | cpython-23109ef11e91c49b56b517ce454bcf87a4153c62.zip cpython-23109ef11e91c49b56b517ce454bcf87a4153c62.tar.gz cpython-23109ef11e91c49b56b517ce454bcf87a4153c62.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_peepholer.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index 913f805..934b57c 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -83,6 +83,23 @@ class TestTranforms(unittest.TestCase): 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): |