classification
Title: multiprocessing.connection.Listener fails with invalid address on Windows
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, pitrou, python-dev
Priority: normal Keywords: patch

Created on 2012-04-03 09:28 by Claudiu.Popa, last changed 2012-04-03 18:21 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
multiprocessing.patch Claudiu.Popa, 2012-04-03 09:28 review
Messages (4)
msg157404 - (view) Author: Claudiu Popa (Claudiu.Popa) * Date: 2012-04-03 09:28
This is related to http://bugs.python.org/issue14151. 
When using an AF_UNIX address with multiprocessing.connection.Listener or Client, the following error will occur, due to the fact that AF_UNIX is not present in socket module.

>>> import multiprocessing.connection as con
>>> con.Listener('/var/a.pipe')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python31\lib\multiprocessing\connection.py", line 97, in __init__
    self._listener = SocketListener(address, family, backlog)
  File "C:\Python31\lib\multiprocessing\connection.py", line 216, in __init__
    self._socket = socket.socket(getattr(socket, family))
AttributeError: 'module' object has no attribute 'AF_UNIX'


The attached patch fixes this issue, the check is done in the newly added _validate_family, where a similar check is done for AF_PIPE on Unix systems.
msg157407 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-03 10:45
Thanks. The patch looks good to me.
msg157434 - (view) Author: Roundup Robot (python-dev) Date: 2012-04-03 18:20
New changeset 57c0867fbf30 by Antoine Pitrou in branch '3.2':
Issue #14482: Raise a ValueError, not a NameError, when trying to create
http://hg.python.org/cpython/rev/57c0867fbf30

New changeset ddc5adcedf29 by Antoine Pitrou in branch 'default':
Issue #14482: Raise a ValueError, not a NameError, when trying to create
http://hg.python.org/cpython/rev/ddc5adcedf29
msg157435 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-03 18:21
Thank you for the patch. It's now committed.
History
Date User Action Args
2012-04-03 18:21:42pitrousetstatus: open -> closed
resolution: fixed
messages: + msg157435

stage: patch review -> resolved
2012-04-03 18:20:38python-devsetnosy: + python-dev
messages: + msg157434
2012-04-03 10:45:16pitrousetmessages: + msg157407
stage: patch review
2012-04-03 09:28:41Claudiu.Popacreate