Jelle Zijlstra
a8ca26d250
annotationlib: Remove some unnecessary dict copies ( #132495 )
2025-04-16 06:16:13 -07:00
Jelle Zijlstra
11f6603845
gh-132491: Rename annotationlib.value_to_string to type_repr ( #132492 )
2025-04-15 20:10:53 +00:00
Jelle Zijlstra
5e80fee41a
gh-129463: Remove two attributes from ForwardRef equality ( #132283 )
2025-04-15 12:58:21 -07:00
Jelle Zijlstra
4d3ad0467e
gh-132064: Make annotationlib use __annotate__ if only it is present ( #132195 )
2025-04-13 16:32:44 -07:00
Jelle Zijlstra
07b8d3117f
gh-132261: Store annotations at hidden internal keys in the class dict ( #132345 )
2025-04-10 21:13:26 -07:00
Jelle Zijlstra
ac14d4a23f
gh-129463, gh-128593: Simplify ForwardRef ( #129465 )
2025-04-05 04:36:34 +00:00
Jelle Zijlstra
255eb375a7
gh-118761: Defer import of functools in annotationlib ( #132059 )
2025-04-04 06:42:22 -07:00
Adam Turner
b3e3cc054c
Remove deferred `typing
import in
annotationlib
` ( #132034 )
2025-04-02 20:30:31 -07:00
Jelle Zijlstra
dcf629213b
gh-119180: Add VALUE_WITH_FAKE_GLOBALS format to annotationlib ( #124415 )
2024-11-26 15:40:13 +00:00
Jelle Zijlstra
d3be6f945a
gh-125614: annotationlib: Fix bug where not all Stringifiers are converted ( #125635 )
2024-10-23 16:27:55 -07:00
larryhastings
626d706a66
Minor edit for code clarification in annotationlib. ( #124805 )
2024-09-30 15:25:56 -07:00
Jelle Zijlstra
2c10832887
gh-119180: Rename SOURCE format to STRING ( #124620 )
2024-09-26 13:49:48 -07:00
Jelle Zijlstra
4e829c0e6f
gh-124412: Add helpers for converting annotations to source format ( #124551 )
2024-09-26 00:01:09 +00:00
Jelle Zijlstra
bc543936ab
gh-119180: Make FORWARDREF format look at __annotations__ first ( #124479 )
...
From discussion with Larry Hastings and Carl Meyer, this is the desired
behavior.
2024-09-25 15:32:45 -07:00
Jelle Zijlstra
17a544b257
gh-119180: Avoid going through AST and eval() when possible in annotationlib ( #124337 )
...
Often, ForwardRefs represent a single simple name. In that case, we
can avoid going through the overhead of creating AST nodes and code
objects and calling eval(): we can simply look up the name directly
in the relevant namespaces.
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-25 21:14:03 +00:00
Jelle Zijlstra
2e0d445364
gh-119180: Fix annotationlib.ForwardRef.evaluate with no globals ( #124326 )
...
We were sometimes passing None as the globals argument to eval(), which makes it
inherit the globals from the calling scope. Instead, ensure that globals is always
non-None. The test was passing accidentally because I passed "annotationlib" as a
module object; fix that. Also document the parameters to ForwardRef() and remove
two unused private ones.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-09-23 19:06:19 +00:00
Jelle Zijlstra
96f619faa7
gh-124206: Fix calling get_annotate_function() on static types ( #124208 )
...
Fixes #124206 . No news entry because the bug this fixes was never
released.
2024-09-18 08:39:22 -07:00
Jelle Zijlstra
4534068f22
gh-119180: annotationlib: Fix __all__, formatting ( #122365 )
2024-08-11 23:44:51 +00:00
Jelle Zijlstra
016f4b5975
gh-119180: Improvements to ForwardRef.evaluate ( #122210 )
...
Noticed some issues while writing documentation for this method.
2024-08-11 23:42:57 +00:00
Jelle Zijlstra
ae192262ad
gh-119180: Add evaluate functions for type params and type aliases ( #122212 )
2024-07-27 17:24:10 +00:00
Jelle Zijlstra
45614ecb2b
gh-119180: Use type descriptors to access annotations (PEP 749) ( #122074 )
2024-07-27 16:36:06 +00:00
Jelle Zijlstra
7b7b90d1ce
gh-119180: Add annotationlib
module to support PEP 649 ( #119891 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-23 21:16:50 +00:00