[Python-checkins] cpython (merge default -> default): merge
michael.foord
python-checkins at python.org
Tue Mar 15 23:38:02 CET 2011
http://hg.python.org/cpython/rev/ab45c4d0b6ef
changeset: 68570:ab45c4d0b6ef
parent: 68569:e592317811f2
parent: 68567:6d884c1a4654
user: Michael Foord <michael at python.org>
date: Tue Mar 15 18:38:41 2011 -0400
summary:
merge
files:
Lib/test/test_peepholer.py
Python/peephole.c
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py
--- a/Lib/test/test_peepholer.py
+++ b/Lib/test/test_peepholer.py
@@ -19,6 +19,7 @@
def dis_single(line):
return disassemble(compile(line, '', 'single'))
+
class TestTranforms(unittest.TestCase):
def test_unot(self):
@@ -294,11 +295,23 @@
self.assertNotIn('BINARY_', asm, e)
self.assertNotIn('BUILD_', asm, e)
+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
diff --git a/Python/peephole.c b/Python/peephole.c
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -535,7 +535,8 @@
}
if (codestr[i+3] != UNPACK_SEQUENCE ||
!ISBASICBLOCK(blocks,i,6) ||
- j != GETARG(codestr, i+3))
+ j != GETARG(codestr, i+3) ||
+ opcode == BUILD_SET)
continue;
if (j == 1) {
memset(codestr+i, NOP, 6);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list