gh-87092: bring compiler code closer to a preprocessing-opt-assembler organisation (GH-97644)

This commit is contained in:
Irit Katriel 2022-10-05 08:52:35 +01:00 committed by GitHub
parent 8079bef56f
commit c529b45122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 40 deletions

View file

@ -670,10 +670,22 @@ if 1:
self.assertIs(f1.__code__.co_linetable, f2.__code__.co_linetable)
@support.cpython_only
def test_strip_unused_consts(self):
def f():
"docstring"
if True:
return "used"
else:
return "unused"
self.assertEqual(f.__code__.co_consts,
("docstring", True, "used"))
# Stripping unused constants is not a strict requirement for the
# Python semantics, it's a more an implementation detail.
@support.cpython_only
def test_strip_unused_consts(self):
def test_strip_unused_None(self):
# Python 3.10rc1 appended None to co_consts when None is not used
# at all. See bpo-45056.
def f1():