]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-111881: Import _sha2 lazily in random (#111889)
authorVictor Stinner <vstinner@python.org>
Thu, 9 Nov 2023 22:10:21 +0000 (23:10 +0100)
committerGitHub <noreply@github.com>
Thu, 9 Nov 2023 22:10:21 +0000 (23:10 +0100)
commitb9f814ce6fdc2fd636bb01e60c60f3ed708a245f
tree16c86ad269d4d818f30205f615352a0686a374f8
parent0802fd6c8ee0cacb3ab555dd86e235a5dfab7618
gh-111881: Import _sha2 lazily in random (#111889)

The random module now imports the _sha2 module lazily in the
Random.seed() method for str, bytes and bytearray seeds. It also
imports lazily the warnings module in the _randbelow() method for
classes without getrandbits(). Lazy import makes Python startup
faster and reduces the number of imported modules at startup.
Lib/random.py