mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue 11510: Fix BUILD_SET optimizer bug.
This commit is contained in:
parent
31f218bc6b
commit
0661e91fed
2 changed files with 15 additions and 2 deletions
|
@ -294,11 +294,23 @@ class TestTranforms(unittest.TestCase):
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue