cpython/Lib/test/test_inspect
Miss Islington (bot) dc441efbd0
[3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) (#133796)
gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415)

This check is potentially problematic because it could force evaluation of
annotations unnecessarily. This doesn't trigger for builtin objects (functions,
classes, or modules) with annotations, but it could trigger for third-party objects.

The check was not particularly useful anyway, because it succeeds if ``__annotations__``
is a dict or None, so the only thing this did was guard against objects that have an
``__annotations__`` attribute that is of some other type. That doesn't seem particularly
useful, so I just removed the check.
(cherry picked from commit cb6596c6aa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2025-05-26 08:22:14 +00:00
..
__init__.py
inspect_deferred_annotations.py gh-101552: Allow pydoc to display signatures in source format (#124669) 2024-10-09 05:03:53 +00:00
inspect_fodder.py gh-101860: Expose __name__ on property (GH-101876) 2024-02-20 17:14:34 +02:00
inspect_fodder2.py gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613) 2024-09-28 20:51:49 +03:00
inspect_stock_annotations.py
inspect_stringized_annotations.py
inspect_stringized_annotations_2.py
inspect_stringized_annotations_pep695.py Add some more edge-case tests for inspect.get_annotations with eval_str=True (#120550) 2024-06-15 12:51:58 +00:00
test_inspect.py [3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) (#133796) 2025-05-26 08:22:14 +00:00