bpo-29535: Remove promize about hash randomization of datetime objects.#15269
Conversation
| "PYTHONHASHSEED: if this variable is set to 'random', a random value is used\n" | ||
| " to seed the hashes of str, bytes and datetime objects. It can also be\n" | ||
| " set to an integer in the range [0,4294967295] to get hash values with a\n" | ||
| " to seed the hashes of str and bytes objects. It can also be set to an\n" |
There was a problem hiding this comment.
This isn't exactly true. PYTHONHASHSEED is also used to seed the hashes of datetime objects (in the cases where hash randomization was implemented for datetime and time objects, mainly in the C implementations).
Would it be better to perhaps change the hash of datetime and time to always be non-randomized, so that the documentation is accurate?
There was a problem hiding this comment.
I think this is not the purpose of setting PYTHONHASHSEED. Yes, the hashes of datetime objects can be affected by setting PYTHONHASHSEED, as well as hashes of any compound object which contains str or bytes objects.
There was a problem hiding this comment.
Sorry, what do you mean?
There was a problem hiding this comment.
The datetimes objects are not special. Changing their hashes is a side effect of changing the hash of bytes objects.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
|
GH-15454 is a backport of this pull request to the 3.8 branch. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
…s. (pythonGH-15269) (cherry picked from commit e9c90aa) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
https://bugs.python.org/issue29535