Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-136438: Make sure test.test_pydoc.test_pydoc pass with all optimization levels #136479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_pydoc/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ def test_special_form(self):
self.assertIn('NoReturn = typing.NoReturn', doc)
self.assertIn(typing.NoReturn.__doc__.strip().splitlines()[0], doc)
else:
self.assertIn('NoReturn = class _SpecialForm(_Final)', doc)
self.assertIn('NoReturn = class _SpecialForm(_Final, _NotIterable)', doc)
Copy link
Member

@StanFromIreland StanFromIreland Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter was added 3 years ago, and popped up now because -OO optimizes away typing.NoReturn.__doc__. I think we need a better solution here, since this is not properly tested.

cc @hauntsaninja who I see added this test

Copy link
Contributor

@hauntsaninja hauntsaninja Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add the test, I just fixed it up to accommodate another change. The test was added in #30253

Not sure that there's a good solution to be had really, maybe you have ideas! pydoc does depend on __doc__... if we want to guarantee tests pass on -OO we probably just have to run tests with -OO


def test_typing_pydoc(self):
def foo(data: typing.List[typing.Any],
Expand Down
Loading