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 41e8e15

Browse filesBrowse files
[3.12] gh-109653: Reduce the import time of random by 60% (GH-110221) (#110247)
gh-109653: Fix regression in the import time of `random` in Python 3.12 (GH-110221) (cherry picked from commit 21a6263) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 892b194 commit 41e8e15
Copy full SHA for 41e8e15

File tree

2 files changed

+3
-1
lines changed
Filter options

2 files changed

+3
-1
lines changed

‎Lib/random.py

Copy file name to clipboardExpand all lines: Lib/random.py
+1-1Lines changed: 1 addition & 1 deletion
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
+2Lines changed: 2 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.