summaryrefslogtreecommitdiff
path: root/lang/python27/patches/patch-Lib_multiprocessing_process.py
blob: 68ef784c2304fc9a9e6816edc4439e83b8ba9696 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$NetBSD: patch-Lib_multiprocessing_process.py,v 1.1 2014/07/17 15:26:49 ryoon Exp $

--- Lib/multiprocessing/process.py.orig	2014-06-30 02:05:29.000000000 +0000
+++ Lib/multiprocessing/process.py
@@ -306,7 +306,15 @@ class _MainProcess(Process):
         self._popen = None
         self._counter = itertools.count(1)
         self._children = set()
-        self._authkey = AuthenticationString(os.urandom(32))
+        # Get randomness from urandom or the 'random' module.
+        # from http://bugs.python.org/issue6645
+        # for SCO OpenServer 5.0.7/3.2 and AIX
+        try:
+            self._authkey = AuthenticationString(os.urandom(32))
+        except:
+            import random
+            bytes = [chr(random.randrange(256)) for i in range(32)]
+            self._authkey = AuthenticationString(bytes)
         self._tempdir = None
 
 _current_process = _MainProcess()