merge 2.6 with hash randomization fix

This commit is contained in:
Benjamin Peterson 2012-02-20 21:44:56 -05:00
commit aee9dfba4a
26 changed files with 2503 additions and 140 deletions

View file

@ -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)