gh-123958: apply docstring removal optimization in ast_opt instead of codegen (#123959)

This commit is contained in:
Irit Katriel 2024-09-11 18:02:28 +01:00 committed by GitHub
parent 2938c3dec9
commit e07154fd1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 23 deletions

View file

@ -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__)