10000 [3.11] Fix test_compile with -O mode (GH-115346) (GH-115673) · python/cpython@e1994c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1994c4

Browse files
[3.11] Fix test_compile with -O mode (GH-115346) (GH-115673)
(cherry picked from commit 7b25a82)
1 parent 0bb94f4 commit e1994c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_compile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ def test_strip_unused_consts(self):
704704
def f1():
705705
"docstring"
706706
return 42
707-
self.assertEqual(f1.__code__.co_consts, ("docstring", 42))
707+
self.assertEqual(f1.__code__.co_consts, (f1.__doc__, 42))
708708

709709
# This is a regression test for a CPython specific peephole optimizer
710710
# implementation bug present in a few releases. It's assertion verifies
@@ -935,6 +935,8 @@ def no_code2():
935935

936936
for func in (no_code1, no_code2):
937937
with self.subTest(func=func):
938+
if func is no_code1 and no_code1.__doc__ is None:
939+
continue
938940
code = func.__code__
939941
lines = list(code.co_lines())
940942
start, end, line = lines[0]

0 commit comments

Comments
 (0)
0