Skip to content

Commit 21a6263

Browse files
authored
gh-109653: Reduce the import time of random by 60% (#110221)
1 parent 4596c76 commit 21a6263

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/random.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
try:
6767
# hashlib is pretty heavy to load, try lean internal module first
68-
from _sha512 import sha512 as _sha512
68+
from _sha2 import sha512 as _sha512
6969
except ImportError:
7070
# fallback to official implementation
7171
from hashlib import sha512 as _sha512
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a Python 3.12 regression in the import time of :mod:`random`. Patch by Alex
2+
Waygood.

0 commit comments

Comments
 (0)