Skip to content
Merged
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

Copy link
Member

Choose a reason for hiding this comment

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

IMO, proposed fix is correct. There was a PR #92262 merged after last test change. For now, _SpecialForm inherits from _Final and _NotIterable, and pydoc reacts on this.


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