gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c (#130032)

This commit is contained in:
Yan Yanchii 2025-02-13 13:11:07 +01:00 committed by GitHub
parent c7a9d06e06
commit 140e69c4a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 231 additions and 120 deletions

View file

@ -798,7 +798,7 @@ class TestSpecifics(unittest.TestCase):
f3 = lambda x: x in {("not a name",)}
self.assertIs(f1.__code__.co_consts[0],
f2.__code__.co_consts[0][0])
self.assertIs(next(iter(f3.__code__.co_consts[0])),
self.assertIs(next(iter(f3.__code__.co_consts[1])),
f2.__code__.co_consts[0])
# {0} is converted to a constant frozenset({0}) by the peephole