Skip to content

Commit c111f92

Browse files
committed
gh-149415: Replace typing._LazyAnnotationLib with lazy import
1 parent ffb543d commit c111f92

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

Lib/typing.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import sys
2929
import types
3030
from types import GenericAlias
31+
lazy import annotationlib as _lazy_annotationlib
3132

3233
from _typing import (
3334
_idfunc,
@@ -163,15 +164,6 @@
163164
'Unpack',
164165
]
165166

166-
class _LazyAnnotationLib:
167-
def __getattr__(self, attr):
168-
global _lazy_annotationlib
169-
import annotationlib
170-
_lazy_annotationlib = annotationlib
171-
return getattr(annotationlib, attr)
172-
173-
_lazy_annotationlib = _LazyAnnotationLib()
174-
175167

176168
def _type_convert(arg, module=None, *, allow_special_forms=False, owner=None):
177169
"""For converting None to type(None), and strings to ForwardRef."""

0 commit comments

Comments
 (0)