Avoiding an import of functools leads to 50% speedup of import time.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
import os as _os
import sys as _sys
import _thread
-import functools
import warnings
from time import monotonic as _time
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
--- /dev/null
+Reduce the import time of :mod:`threading` module by ~50%. Patch by Daniel Hollas.