mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
enable hash randomization by default
This commit is contained in:
parent
6ca5a4d49f
commit
c9f54cf512
9 changed files with 44 additions and 65 deletions
|
@ -330,14 +330,14 @@ class CmdLineTest(unittest.TestCase):
|
|||
hashes = []
|
||||
for i in range(2):
|
||||
code = 'print(hash("spam"))'
|
||||
rc, out, err = assert_python_ok('-R', '-c', code)
|
||||
rc, out, err = assert_python_ok('-c', code)
|
||||
self.assertEqual(rc, 0)
|
||||
hashes.append(out)
|
||||
self.assertNotEqual(hashes[0], hashes[1])
|
||||
|
||||
# Verify that sys.flags contains hash_randomization
|
||||
code = 'import sys; print("random is", sys.flags.hash_randomization)'
|
||||
rc, out, err = assert_python_ok('-R', '-c', code)
|
||||
rc, out, err = assert_python_ok('-c', code)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertIn(b'random is 1', out)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue