mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-123958: apply docstring removal optimization in ast_opt instead of codegen (#123959)
This commit is contained in:
parent
2938c3dec9
commit
e07154fd1e
5 changed files with 47 additions and 23 deletions
|
@ -876,6 +876,10 @@ class TestSpecifics(unittest.TestCase):
|
|||
def with_docstring():
|
||||
"docstring"
|
||||
|
||||
def two_strings():
|
||||
"docstring"
|
||||
"not docstring"
|
||||
|
||||
def with_fstring():
|
||||
f"not docstring"
|
||||
|
||||
|
@ -891,8 +895,10 @@ class TestSpecifics(unittest.TestCase):
|
|||
|
||||
if opt < 2:
|
||||
self.assertEqual(ns['with_docstring'].__doc__, "docstring")
|
||||
self.assertEqual(ns['two_strings'].__doc__, "docstring")
|
||||
else:
|
||||
self.assertIsNone(ns['with_docstring'].__doc__)
|
||||
self.assertIsNone(ns['two_strings'].__doc__)
|
||||
self.assertIsNone(ns['with_fstring'].__doc__)
|
||||
self.assertIsNone(ns['with_const_expression'].__doc__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue