Skip to content
Merged
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
Next Next commit
Speed up import of threading module
Delayed import of functools leads to 50% speedup
of import time.
  • Loading branch information
danielhollas committed Jan 23, 2024
commit 2a73912c9cbb579207ff6ca4eeff78c2fddd3d69
2 changes: 1 addition & 1 deletion Lib/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os as _os
import sys as _sys
import _thread
import functools
import warnings
import _weakref

Expand Down Expand Up @@ -1630,6 +1629,7 @@ def _register_atexit(func, *arg, **kwargs):
if _SHUTTING_DOWN:
raise RuntimeError("can't register atexit after shutdown")

import functools
call = functools.partial(func, *arg, **kwargs)
_threading_atexits.append(call)
Comment thread
danielhollas marked this conversation as resolved.
Outdated

Expand Down