@@ -352,17 +352,20 @@ def test_deterministic_sets(self):
352
352
for elements in (
353
353
"float('nan'), b'a', b'b', b'c', 'x', 'y', 'z'" ,
354
354
# Also test for bad interactions with backreferencing:
355
- "('string ', 1 ), ('string ', 2 ), ('string ', 3 )" ,
355
+ "('Spam ', 0 ), ('Spam ', 1 ), ('Spam ', 2 )" ,
356
356
):
357
357
s = f"{ kind } ([{ elements } ])"
358
358
with self .subTest (s ):
359
359
# First, make sure that our test case still has different
360
360
# orders under hash seeds 0 and 1. If this check fails, we
361
- # need to update this test with different elements:
362
- args = ["-c" , f"print({ s } )" ]
363
- _ , repr_0 , _ = assert_python_ok (* args , PYTHONHASHSEED = "0" )
364
- _ , repr_1 , _ = assert_python_ok (* args , PYTHONHASHSEED = "1" )
365
- self .assertNotEqual (repr_0 , repr_1 )
361
+ # need to update this test with different elements. Skip
362
+ # this part if we are configured to use any other hash
363
+ # algorithm (for example, using Py_HASH_EXTERNAL):
364
+ if sys .hash_info .algorithm in {"fnv" , "siphash24" }:
365
+ args = ["-c" , f"print({ s } )" ]
366
+ _ , repr_0 , _ = assert_python_ok (* args , PYTHONHASHSEED = "0" )
367
+ _ , repr_1 , _ = assert_python_ok (* args , PYTHONHASHSEED = "1" )
368
+ self .assertNotEqual (repr_0 , repr_1 )
366
369
# Then, perform the actual test:
367
370
args = ["-c" , f"import marshal; print(marshal.dumps({ s } ))" ]
368
371
_ , dump_0 , _ = assert_python_ok (* args , PYTHONHASHSEED = "0" )
0 commit comments