summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ramacher <sebastian+dev@ramacher.at>2013-10-17 19:56:11 +0200
committerSebastian Ramacher <sebastian+dev@ramacher.at>2013-10-17 19:56:11 +0200
commit845055208d8f5fa153faf646f18876c4a1b9cc84 (patch)
tree870cabd364eeaae00100d81d7ece0e1f4538f9ef
parent7fd528d03b5eae58eef6fd219af5d9ac9c83fa50 (diff)
downloadpycrypto-pyca.tar.gz
Do not run multiprocessing test if multiprocessing.synchronize is not workingpyca2.6.x
On platforms that do not have a working sem_open implementation, importing multiprocessing.synchronize will fail with an ImportError. While creating a multiprocessing.Pool instance, multiprocessing.synchronize will be imported and might throw an ImportError. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
-rw-r--r--lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py b/lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py
index 771a663..3fd7ad4 100644
--- a/lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py
+++ b/lib/Crypto/SelfTest/Random/test__UserFriendlyRNG.py
@@ -39,6 +39,11 @@ from Crypto.Util.py3compat import *
try:
import multiprocessing
+ # multiprocessing.Pool uses classes from multiprocessing.synchronize, so we
+ # need to check if multiprocessing.semaphore will work. Otherwise creating a
+ # multiprocessing.Pool instance will fail with an ImportError. See Python
+ # bug #3770 for details.
+ import multiprocessing.synchronize
except ImportError:
multiprocessing = None