mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
merge 2.6 with hash randomization fix
This commit is contained in:
commit
aee9dfba4a
26 changed files with 2503 additions and 140 deletions
|
|
@ -86,6 +86,20 @@ class CmdLineTest(unittest.TestCase):
|
|||
self.exit_code('-c', 'pass'),
|
||||
0)
|
||||
|
||||
def test_hash_randomization(self):
|
||||
# Verify that -R enables hash randomization:
|
||||
self.verify_valid_flag('-R')
|
||||
hashes = []
|
||||
for i in range(2):
|
||||
code = 'print(hash("spam"))'
|
||||
data = self.start_python('-R', '-c', code)
|
||||
hashes.append(data)
|
||||
self.assertNotEqual(hashes[0], hashes[1])
|
||||
|
||||
# Verify that sys.flags contains hash_randomization
|
||||
code = 'import sys; print sys.flags'
|
||||
data = self.start_python('-R', '-c', code)
|
||||
self.assertTrue('hash_randomization=1' in data)
|
||||
|
||||
def test_main():
|
||||
test.test_support.run_unittest(CmdLineTest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue