GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-136438: Make sure test.test_pydoc.test_pydoc pass with all optimization levels by Grivvus · Pull Request #136479 · python/cpython

Conversation

@Grivvus

@Grivvus Grivvus commented Jul 9, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Output before:

test test.test_pydoc.test_pydoc failed -- Traceback (most recent call last):
  File "/home/grivvus/cpython/Lib/test/test_pydoc/test_pydoc.py", line 1464, in test_special_form
    self.assertIn('NoReturn = class _SpecialForm(_Final)', doc)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'NoReturn = class _SpecialForm(_Final)' not found in 'Python Library Documentation: _SpecialForm in module typing object\n\nNoReturn = class _SpecialForm(_Final, _NotIterable)\n |  NoReturn(getitem)\n |\n |  # Internal indicator of special typing constructs.\n |  # See __doc__ instance attribute for specific docs.\n |\n |  Method resolution order:\n |      _SpecialForm\n |      _Final\n |      _NotIterable\n |      builtins.object\n |\n |  Methods defined here:\n |\n |  __call__(self, *args, **kwds)\n |      Call self as a function.\n |\n |  __getattr__(self, item)\n |\n |  __getitem__(self, parameters)\n |\n |  __init__(self, getitem)\n |      Initialize self.  See help(type(self)) for accurate signature.\n |\n |  __instancecheck__(self, obj)\n |      Check if an object is an instance.\n |\n |  __mro_entries__(self, bases)\n |\n |  __or__(self, other)\n |      Return self|value.\n |\n |  __reduce__(self)\n |      Helper for pickle.\n |\n |  __repr__(self)\n |      Return repr(self).\n |\n |  __ror__(self, other)\n |      Return value|self.\n |\n |  __subclasscheck__(self, cls)\n |      Check if a class is a subclass.\n |\n |  ----------------------------------------------------------------------\n |  Class methods inherited from _Final:\n |\n |  __init_subclass__(*args, **kwds)\n |      This method is called when a class is subclassed.\n |\n |      The default implementation does nothing. It may be\n |      overridden to extend subclasses.\n |\n |  ----------------------------------------------------------------------\n |  Data descriptors inherited from _Final:\n |\n |  __weakref__\n |      list of weak references to the object\n |\n |  ----------------------------------------------------------------------\n |  Data and other attributes inherited from _NotIterable:\n |\n |  __iter__ = None\n'

0:00:02 load avg: 0.60 [1/1/1] test.test_pydoc.test_pydoc failed (1 failure)

== Tests result: FAILURE ==
  • Issue: Multiple tests fail with -OO #136438

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Grivvus
test_pydoc.test_pydoc now passes with -OO
24b92d2
@python-cla-bot

python-cla-bot Bot commented Jul 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added the awaiting review label Jul 9, 2025
@bedevere-app

bedevere-app Bot commented Jul 9, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jul 9, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jul 9, 2025
Multiple tests fail with -OO #136438
Closed
8 tasks done
@StanFromIreland StanFromIreland added the skip news label Jul 10, 2025
@StanFromIreland
StanFromIreland requested a review from sobolevn July 10, 2025 06:29
StanFromIreland
StanFromIreland reviewed Jul 10, 2025
View reviewed changes
Comment thread Lib/test/test_pydoc/test_pydoc.py
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)

@StanFromIreland StanFromIreland Jul 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@hauntsaninja hauntsaninja Jul 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@efimov-mikhail efimov-mikhail Oct 11, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
efimov-mikhail
efimov-mikhail approved these changes Oct 11, 2025
View reviewed changes

@efimov-mikhail efimov-mikhail left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Oct 11, 2025
hauntsaninja
hauntsaninja approved these changes Oct 12, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 12, 2025
@hauntsaninja
hauntsaninja merged commit bb85af3 into python:main Oct 12, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 12, 2025
@bedevere-bot

bedevere-bot commented Oct 12, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Fedora Stable Refleaks 3.x (tier-1) has failed when building commit bb85af3.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/320/builds/3138) and take a look at the build logs.
  4. Check if the failure is related to this commit (bb85af3) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/320/builds/3138

Failed tests:

  • test_pyrepl
  • test.test_multiprocessing_fork.test_processes

Failed subtests:

  • test_repl_eio - test.test_pyrepl.test_unix_console.TestUnixConsoleEIOHandling.test_repl_eio
  • test_interrupt - test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/test_pyrepl/test_unix_console.py", line 376, in test_repl_eio
    _, err = proc.communicate(timeout=support.LONG_TIMEOUT)
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/subprocess.py", line 1219, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/subprocess.py", line 2126, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/subprocess.py", line 1266, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '['/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/python', '-E', '-S', '/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/test_pyrepl/eio_test_script.py']' timed out after 675.0 seconds


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 596, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 577, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 573, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-2' pid=2721947 parent=2721933 started daemon>


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 524, in _sleep_some_event
    time.sleep(100)
    ~~~~~~~~~~^^^^^
KeyboardInterrupt
k


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/subprocess.py", line 1137, in __del__
    _warn("subprocess %s is still running" % self.pid,
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          ResourceWarning, source=self)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: subprocess 2668488 is still running
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=8 mode='rb' closefd=True>:
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 165, in _load_run_test
    regrtest_runner(result, test_func, runtests)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 114, in regrtest_runner
    refleak, test_result = runtest_refleak(result.test_name, test_func,
                           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.hunt_refleak,
                                           ^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.quiet)
                                           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/refleak.py", line 145, in runtest_refleak
    result = test_func()
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 162, in test_func
    return run_unittest(test_mod, runtests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 42, in run_unittest
    return _run_suite(tests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 105, in _run_suite
    raise support.TestFailedWithDetails(err, errors, failures, stats=stats)


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/support/__init__.py", line 847, in gc_collect
    gc.collect()
    ~~~~~~~~~~^^
ResourceWarning: unclosed file <_io.FileIO name=8 mode='rb' closefd=True>
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=10 mode='rb' closefd=True>:
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 165, in _load_run_test
    regrtest_runner(result, test_func, runtests)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 114, in regrtest_runner
    refleak, test_result = runtest_refleak(result.test_name, test_func,
                           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.hunt_refleak,
                                           ^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.quiet)
                                           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/refleak.py", line 145, in runtest_refleak
    result = test_func()
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 162, in test_func
    return run_unittest(test_mod, runtests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 42, in run_unittest
    return _run_suite(tests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 105, in _run_suite
    raise support.TestFailedWithDetails(err, errors, failures, stats=stats)


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/support/__init__.py", line 847, in gc_collect
    gc.collect()
    ~~~~~~~~~~^^
ResourceWarning: unclosed file <_io.FileIO name=10 mode='rb' closefd=True>


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 165, in _load_run_test
    regrtest_runner(result, test_func, runtests)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 114, in regrtest_runner
    refleak, test_result = runtest_refleak(result.test_name, test_func,
                           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.hunt_refleak,
                                           ^^^^^^^^^^^^^^^^^^^^^^
                                           runtests.quiet)
                                           ^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/refleak.py", line 145, in runtest_refleak
    result = test_func()
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 162, in test_func
    return run_unittest(test_mod, runtests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 42, in run_unittest
    return _run_suite(tests)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/libregrtest/single.py", line 105, in _run_suite
    raise support.TestFailedWithDetails(err, errors, failures, stats=stats)


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 596, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 577, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 573, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-147' pid=2620893 parent=2616818 started daemon>
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@StanFromIreland StanFromIreland StanFromIreland left review comments
@efimov-mikhail efimov-mikhail efimov-mikhail approved these changes
@hauntsaninja hauntsaninja hauntsaninja approved these changes
@sobolevn sobolevn Awaiting requested review from sobolevn

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@Grivvus @bedevere-bot @efimov-mikhail @hauntsaninja @StanFromIreland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.