Skip to content

Failure when running test_inspect locally #136549

Closed

Description

@ZeroIntensity

Bug report

Bug description:

When running test_inspect locally (either via unittest or via executing Lib/test/test_inspect/test_inspect.py), I see this failure:

ERROR: test_threading_module_has_signatures (__main__.TestSignatureDefinitions.test_threading_module_has_signatures) [supported] (builtin='excepthook')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/peter/develop/cpython/Lib/test/test_inspect/test_inspect.py", line 5717, in _test_module_has_signatures
    self.assertIsNotNone(inspect.signature(obj))
                         ~~~~~~~~~~~~~~~~~^^^^^
  File "/home/peter/develop/cpython/Lib/inspect.py", line 3312, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   globals=globals, locals=locals, eval_str=eval_str,
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   annotation_format=annotation_format)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/develop/cpython/Lib/inspect.py", line 3027, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
                                    follow_wrapper_chains=follow_wrapped,
                                    globals=globals, locals=locals, eval_str=eval_str,
                                    annotation_format=annotation_format)
  File "/home/peter/develop/cpython/Lib/inspect.py", line 2508, in _signature_from_callable
    return _signature_from_builtin(sigcls, obj,
                                   skip_bound_arg=skip_bound_arg)
  File "/home/peter/develop/cpython/Lib/inspect.py", line 2294, in _signature_from_builtin
    return _signature_fromstr(cls, func, s, skip_bound_arg)
  File "/home/peter/develop/cpython/Lib/inspect.py", line 2150, in _signature_fromstr
    raise ValueError("{!r} builtin has invalid signature".format(obj))
ValueError: <built-in function _excepthook> builtin has invalid signature

I'm able to reproduce this back to 3.13, so it's definitely not a recent failure.

Interestingly, this failure does not show up when running through regrtest (python -m test test_inspect), both in CI or locally. I'm not sure if this is a misconfiguration that regrtest fixes, or an actual bug that's being hidden.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    3.13only security fixes
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Jul 11, 2025
  2. ZeroIntensity commented on Jul 11, 2025

    @ZeroIntensity
    MemberAuthor

    Bisected to #117816, cc @serhiy-storchaka

  3. added 2 commits that reference this issue on Jul 11, 2025
  4. added 2 commits that reference this issue on Jul 12, 2025
  5. added 2 commits that reference this issue on Jul 12, 2025
  6. added a commit that references this issue on Jul 13, 2025
  7. added a commit that references this issue on Aug 4, 2025
  8. added a commit that references this issue on Aug 19, 2025
  9. added a commit that references this issue on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixes3.14bugs and security fixes3.15bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions