Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 40d1de7

Browse filesBrowse files
authored
gh-109653: Avoid a top-level import of types in functools (#109804)
1 parent 8d365b6 commit 40d1de7
Copy full SHA for 40d1de7

File tree

2 files changed

+4
-1
lines changed
Filter options

2 files changed

+4
-1
lines changed

‎Lib/functools.py

Copy file name to clipboardExpand all lines: Lib/functools.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
# import types, weakref # Deferred to single_dispatch()
2020
from reprlib import recursive_repr
2121
from _thread import RLock
22-
from types import GenericAlias
2322

23+
# Avoid importing types, so we can speedup import time
24+
GenericAlias = type(list[int])
2425

2526
################################################################################
2627
### update_wrapper() and wraps() decorator
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve import time of :mod:`functools` by around 13%. Patch by Alex
2+
Waygood.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.