https://github.com/python/cpython/commit/e1994c43c0086e049c70aa895d34434bda67eaf9
commit: e1994c43c0086e049c70aa895d34434bda67eaf9
branch: 3.11
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-02-19T18:06:13Z
summary:
[3.11] Fix test_compile with -O mode (GH-115346) (GH-115673)
(cherry picked from commit 7b25a82e83ad8fe15e4302bb7655309573affa83)
files:
M Lib/test/test_compile.py
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 408064919b0b49..7b0a512f2800d2 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -704,7 +704,7 @@ def test_strip_unused_consts(self):
def f1():
"docstring"
return 42
- self.assertEqual(f1.__code__.co_consts, ("docstring", 42))
+ self.assertEqual(f1.__code__.co_consts, (f1.__doc__, 42))
# This is a regression test for a CPython specific peephole optimizer
# implementation bug present in a few releases. It's assertion verifies
@@ -935,6 +935,8 @@ def no_code2():
for func in (no_code1, no_code2):
with self.subTest(func=func):
+ if func is no_code1 and no_code1.__doc__ is None:
+ continue
code = func.__code__
lines = list(code.co_lines())
start, end, line = lines[0]
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]