Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 974bf38

Browse files
committed
MNT: import time: Avoid importing Threading in bit_genrator
1 parent 354cdcf commit 974bf38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

numpy/random/bit_generator.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ except ImportError:
4444
randbits = SystemRandom().getrandbits
4545

4646
try:
47-
from threading import Lock
47+
# Threading isn't the cheapest import. Import from the lightweight
48+
# _thread module,
49+
from _thread import allocate_lock as Lock
4850
except ImportError:
4951
from dummy_threading import Lock
5052

0 commit comments

Comments
 (0)