]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Call randseed() before other imports in deccheck.py (GH-21834)
authorStefan Krah <skrah@bytereef.org>
Tue, 11 Aug 2020 19:14:51 +0000 (21:14 +0200)
committerGitHub <noreply@github.com>
Tue, 11 Aug 2020 19:14:51 +0000 (21:14 +0200)
Modules/_decimal/tests/deccheck.py

index 0b2a1c49336ef01d1491c4e7f74fc9c2947bbfa2..ca869f4dbf5d8c7f0891eed4d57d3355661176bb 100644 (file)
 #
 
 
+import random
+import time
+
+RANDSEED = int(time.time())
+random.seed(RANDSEED)
+
 import sys
 import os
-import time
-import random
 from copy import copy
 from collections import defaultdict
 
@@ -1235,10 +1239,6 @@ if __name__ == '__main__':
         args.single = args.single[0]
 
 
-    randseed = int(time.time())
-    random.seed(randseed)
-
-
     # Set up the testspecs list. A testspec is simply a dictionary
     # that determines the amount of different contexts that 'test_method'
     # will generate.
@@ -1306,9 +1306,9 @@ if __name__ == '__main__':
     if args.multicore:
         q = Queue()
     elif args.single:
-        log("Random seed: %d", randseed)
+        log("Random seed: %d", RANDSEED)
     else:
-        log("\n\nRandom seed: %d\n\n", randseed)
+        log("\n\nRandom seed: %d\n\n", RANDSEED)
 
 
     FOUND_METHOD = False