summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-04-01 15:19:09 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-04-01 15:19:09 (GMT)
commit709176f10c1774f608a318171a94371e7d05d98f (patch)
tree8b9f881e5ddd25e8ac8be7de98a69afe838965d2 /Lib/multiprocessing
parent58bb82e7b4b50fa5efaefc1196bd927992fbe783 (diff)
downloadcpython-709176f10c1774f608a318171a94371e7d05d98f.zip
cpython-709176f10c1774f608a318171a94371e7d05d98f.tar.gz
cpython-709176f10c1774f608a318171a94371e7d05d98f.tar.bz2
Issue #14151: Raise a ValueError, not a NameError, when trying to create
a multiprocessing Client or Listener with an AF_PIPE type address under non-Windows platforms. Patch by Popa Claudiu.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index df00f1d..fa6f7b3 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -94,6 +94,13 @@ def arbitrary_address(family):
else:
raise ValueError('unrecognized family')
+def _validate_family(family):
+ '''
+ Checks if the family is valid for the current environment.
+ '''
+ if sys.platform != 'win32' and family == 'AF_PIPE':
+ raise ValueError('Family %s is not recognized.' % family)
+
def address_type(address):
'''
@@ -126,6 +133,7 @@ class Listener(object):
or default_family
address = address or arbitrary_address(family)
+ _validate_family(family)
if family == 'AF_PIPE':
self._listener = PipeListener(address, backlog)
else:
@@ -163,6 +171,7 @@ def Client(address, family=None, authkey=None):
Returns a connection to the address of a `Listener`
'''
family = family or address_type(address)
+ _validate_family(family)
if family == 'AF_PIPE':
c = PipeClient(address)
else: