summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_peepholer.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-03-15 21:50:16 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-03-15 21:50:16 (GMT)
commit29dcaad6eb47d27fc2d450ae6d81cdf1d740be38 (patch)
tree2ec6c0e148255b045c302b554ac96fe57d1587e1 /Lib/test/test_peepholer.py
parent729c5e203da8adc06acddaa3e7ea472d9c255774 (diff)
downloadcpython-29dcaad6eb47d27fc2d450ae6d81cdf1d740be38.zip
cpython-29dcaad6eb47d27fc2d450ae6d81cdf1d740be38.tar.gz
cpython-29dcaad6eb47d27fc2d450ae6d81cdf1d740be38.tar.bz2
Issue 11510: Fix BUILD_SET optimizer bug.
Diffstat (limited to 'Lib/test/test_peepholer.py')
-rw-r--r--Lib/test/test_peepholer.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
index 531b425..b7d446f 100644
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -267,11 +267,23 @@ class TestTranforms(unittest.TestCase):
asm = disassemble(f)
self.assertNotIn('BINARY_ADD', asm)
+class TestBuglets(unittest.TestCase):
+
+ def test_bug_11510(self):
+ # folded constant set optimization was commingled with the tuple
+ # unpacking optimization which would fail if the set had duplicate
+ # elements so that the set length was unexpected
+ def f():
+ x, y = {1, 1}
+ return x, y
+ with self.assertRaises(ValueError):
+ f()
+
def test_main(verbose=None):
import sys
from test import support
- test_classes = (TestTranforms,)
+ test_classes = (TestTranforms, TestBuglets)
support.run_unittest(*test_classes)
# verify reference counting