mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
ensure no one tries to hash things before the random seed is found
This commit is contained in:
parent
9571155ae4
commit
69e9727657
5 changed files with 15 additions and 4 deletions
|
|
@ -896,6 +896,7 @@ bytes_hash(PyBytesObject *a)
|
|||
register unsigned char *p;
|
||||
register long x;
|
||||
|
||||
assert(_Py_HashSecret_Initialized);
|
||||
if (a->ob_shash != -1)
|
||||
return a->ob_shash;
|
||||
len = Py_SIZE(a);
|
||||
|
|
|
|||
|
|
@ -7341,6 +7341,7 @@ unicode_hash(PyUnicodeObject *self)
|
|||
Py_UNICODE *p;
|
||||
long x;
|
||||
|
||||
assert(_Py_HashSecret_Initialized);
|
||||
if (self->hash != -1)
|
||||
return self->hash;
|
||||
len = Py_SIZE(self);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue