diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2025-04-04 15:57:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-04 15:57:10 (GMT) |
commit | 305be5fb1a1ece7f9651ae98053dbe79bf439aa4 (patch) | |
tree | 8d5cc9e5b0a9b2d7c3fb5a8da2056cb0b572a774 /Python/bytecodes.c | |
parent | 04bc681e7cf5b7effd99e676b7deceb27fb34434 (diff) | |
download | cpython-305be5fb1a1ece7f9651ae98053dbe79bf439aa4.zip cpython-305be5fb1a1ece7f9651ae98053dbe79bf439aa4.tar.gz cpython-305be5fb1a1ece7f9651ae98053dbe79bf439aa4.tar.bz2 |
gh-118761: Lazily import annotationlib in typing (#132060)
annotationlib is used quite a few times in typing.py, but I think the
usages are just rare enough that this makes sense.
The import would get triggered by:
- Using get_type_hints(), evaluate_forward_ref(), and similar introspection
functions
- Using a string annotation anywhere that goes through _type_convert (e.g.,
"Final['x']" will trigger an annotationlib import in order to access the
ForwardRef class).
- Creating a TypedDict or NamedTuple (unless it's empty or PEP 563 is on).
Lots of programs will want to use typing without any of these, so the tradeoff
seems worth it.
Diffstat (limited to 'Python/bytecodes.c')
0 files changed, 0 insertions, 0 deletions