Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Also defer functools import
  • Loading branch information
DavidCEllis committed Apr 2, 2025
commit 10f35b274e437ad7de98e0963e8e0ed193b9d118
11 changes: 7 additions & 4 deletions Lib/annotationlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import builtins
import enum
import functools
import keyword
import sys
import types
Expand All @@ -23,12 +22,16 @@ class _LazyImporter:
def __getattr__(self, name):
if name == "ast":
import ast
setattr(self, "ast", ast)
self.ast = ast
return ast
elif name == "_Stringifier":
from ._stringifier import _Stringifier
setattr(self, "_Stringifier", _Stringifier)
self._Stringifier = _Stringifier
return _Stringifier
elif name == "functools":
import functools
self.functools = functools
return functools
else:
raise AttributeError(
f"{self.__class__.__name__!r} object has no attribute {name!r}"
Expand Down Expand Up @@ -588,7 +591,7 @@ def get_annotations(
if hasattr(unwrap, "__wrapped__"):
unwrap = unwrap.__wrapped__
continue
if isinstance(unwrap, functools.partial):
if isinstance(unwrap, _laz.functools.partial):
unwrap = unwrap.func
continue
break
Expand Down