diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-11-29 00:58:46 +0900 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-11-28 16:58:46 +0100 |
commit | f7e4d3642fbb88f4e6243c952a0e223fb5df1c65 (patch) | |
tree | 1a6c12cbe54e48774c7723e6d54136d78a168742 /Lib/test | |
parent | 1cdfcfc9843d35ab2cb87387d3a79b2c8a585a38 (diff) | |
download | cpython-git-f7e4d3642fbb88f4e6243c952a0e223fb5df1c65.tar.gz |
bpo-34100: compile: Re-enable frozenset merging (GH-10760)
This reverts commit 1005c84535191a72ebb7587d8c5636a065b7ed79.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_compile.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index a086ef65b4..56f73f6315 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -615,6 +615,14 @@ if 1: self.check_constant(f1, Ellipsis) self.assertEqual(repr(f1()), repr(Ellipsis)) + # Merge constants in tuple or frozenset + f1, f2 = lambda: "not a name", lambda: ("not a name",) + f3 = lambda x: x in {("not a name",)} + self.assertIs(f1.__code__.co_consts[1], + f2.__code__.co_consts[1][0]) + self.assertIs(next(iter(f3.__code__.co_consts[1])), + f2.__code__.co_consts[1]) + # {0} is converted to a constant frozenset({0}) by the peephole # optimizer f1, f2 = lambda x: x in {0}, lambda x: x in {0} |