Commit dc441ef
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 cb6596c)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent 1ce68f6 commit dc441ef
File tree
3 files changed
+34
-3
lines changed- Lib
- test/test_inspect
- Misc/NEWS.d/next/Library
3 files changed
+34
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2074 | 2074 | | |
2075 | 2075 | | |
2076 | 2076 | | |
2077 | | - | |
2078 | 2077 | | |
2079 | 2078 | | |
2080 | 2079 | | |
2081 | 2080 | | |
2082 | | - | |
2083 | | - | |
| 2081 | + | |
2084 | 2082 | | |
2085 | 2083 | | |
2086 | 2084 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4997 | 4997 | | |
4998 | 4998 | | |
4999 | 4999 | | |
| 5000 | + | |
| 5001 | + | |
| 5002 | + | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
| 5023 | + | |
| 5024 | + | |
| 5025 | + | |
| 5026 | + | |
| 5027 | + | |
| 5028 | + | |
| 5029 | + | |
| 5030 | + | |
5000 | 5031 | | |
5001 | 5032 | | |
5002 | 5033 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments