diff options
author | Raymond Hettinger <python@rcn.com> | 2004-10-26 08:59:14 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-10-26 08:59:14 +0000 |
commit | d379e8cfc6667f934c5994c5633e24a40c5cc07d (patch) | |
tree | bfccca207c3203c54b0b5ad16117bec39220888c /Lib/test/test_peepholer.py | |
parent | 99df84df646e0ebc7c759d6e116ba088173e3d30 (diff) | |
download | cpython-d379e8cfc6667f934c5994c5633e24a40c5cc07d.tar.gz |
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/test/test_peepholer.py')
-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 913f805e12..934b57c1e8 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): |