Skip to content

[3.14] gh-132493: Remove __annotations__ usage in inspect._signature_is_functionlike (GH-133415) #133796

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: 3.14
Choose a base branch
from

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 10, 2025

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 cb6596c)

Co-authored-by: Jelle Zijlstra jelle.zijlstra@gmail.com

…s_functionlike (pythonGH-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 cb6596c6aa30c8c3213c8746d5590e6e2757a6c1)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) May 10, 2025 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants