mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated. The environment variable PYTHONHASHSEED and the new command line flag -R control this behavior.
This commit is contained in:
commit
09a7c72cad
34 changed files with 676 additions and 162 deletions
|
@ -14,7 +14,7 @@ class BasicTestMappingProtocol(unittest.TestCase):
|
|||
def _reference(self):
|
||||
"""Return a dictionary of values which are invariant by storage
|
||||
in the object under test."""
|
||||
return {1:2, "key1":"value1", "key2":(1,2,3)}
|
||||
return {"1": "2", "key1":"value1", "key2":(1,2,3)}
|
||||
def _empty_mapping(self):
|
||||
"""Return an empty mapping object"""
|
||||
return self.type2test()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue