diff options
author | Daniel Hollas <danekhollas@gmail.com> | 2024-01-31 09:29:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-31 09:29:44 (GMT) |
commit | 5e390a0fc825f21952beb158e2bda3c5e007fac9 (patch) | |
tree | e34fcbd54e1700bf8ba9424bc50946f569f04074 /Lib/threading.py | |
parent | c8cf5d7d148944f2850f25b02334400dd0238cb0 (diff) | |
download | cpython-5e390a0fc825f21952beb158e2bda3c5e007fac9.zip cpython-5e390a0fc825f21952beb158e2bda3c5e007fac9.tar.gz cpython-5e390a0fc825f21952beb158e2bda3c5e007fac9.tar.bz2 |
gh-109653: Speedup import of threading module (#114509)
Avoiding an import of functools leads to 50% speedup of import time.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 00b95f8..75a08e5 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -3,7 +3,6 @@ import os as _os import sys as _sys import _thread -import functools import warnings from time import monotonic as _time @@ -1630,8 +1629,7 @@ def _register_atexit(func, *arg, **kwargs): if _SHUTTING_DOWN: raise RuntimeError("can't register atexit after shutdown") - call = functools.partial(func, *arg, **kwargs) - _threading_atexits.append(call) + _threading_atexits.append(lambda: func(*arg, **kwargs)) from _thread import stack_size |