| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Given that this is a regression, should we backport it into 3.12? |
Sorry, something went wrong.
I was wondering that. I'd vote in favour of doing so, since it doesn't seem particularly high-risk to me. But I'd like to hear Raymond's and/or Greg's thoughts. |
Sorry, something went wrong.
|
A backport to 3.12 would be reasonable. |
Sorry, something went wrong.
Great, I've scheduled the backport. Thanks for the review! |
Sorry, something went wrong.
|
Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
|
GH-110247 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot aarch64 Debian Clang LTO + PGO 3.x has failed when building commit 21a6263. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/1084/builds/2183 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/var/lib/buildbot/workers/arm64-clang/3.x.gps-arm64-debian.clang.lto-pgo/build/Lib/test/test_concurrent_futures/test_shutdown.py", line 50, in test_interpreter_shutdown
self.assertEqual(out.strip(), b"apple")
AssertionError: b'' != b'apple'
|
Sorry, something went wrong.
| @@ -65,7 +65,7 @@ | |||
|
|
|||
| try: | |||
| # hashlib is pretty heavy to load, try lean internal module first | |||
There was a problem hiding this comment.
This code is technically awkward... It tried to speed up import time and did so by circumventing hashlib which means that it is loading and using the slowest possible sha512 implementation by default (hashlib will pick up openssl 3's accelerated sha512 support by default on most platforms and not use our builtin). so faster startup time for a slower runtime computation? thankfully this is only ever used by seed() which is a single/constant number of calls for most programs on tiny data so there is zero reason to care about sha512 performance for its purposes. The slower implementation may still be faster on small seed data anyways due to less setup overhead.
Nothing to do here. This works for random's purposes & thanks for the fixup. But this being a regression in the first place demonstrates how fragile direct use of internal details can be. (and indirectly how much in need of an overhaul hashlib.py could use)
I'd file an issue rather than leaving this comment in the merged PR void if there were anything concrete to describe and tackle, there isn't. :)
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
As an optimisation to reduce the import time of the module, random first tries to import sha512 from the internal _sha512 module before falling back to hashlib. The problem, however, is that Python no longer has a _sha512 module! It was removed in 0b13575, by @gpshead. That means we're currently always falling back to the slow path in random.py, leading to the import time of random being far slower than it should be.
Importing sha512 from the correct module in the fast path cuts 60% off the import time of random.