This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing.connection.Listener fails with invalid address
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-02-28 13:51 by Claudiu.Popa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
connection.patch Claudiu.Popa, 2012-02-28 13:51
connection.diff Claudiu.Popa, 2012-04-01 15:15
test_multiprocessing.diff Claudiu.Popa, 2012-04-01 15:15
Messages (5)
msg154552 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2012-02-28 13:51
In multiprocessing.connection, when using a Windows named pipe on a Unix platform, the following error will occur. This should not happen, the format of the address should be validated somehow before. The following error will occur because PipeListener is not defined under any platform different than win32. 

Python 3.2.2 (default, Oct 14 2011, 21:46:49)
[GCC 4.2.2 20070831 prerelease [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing.connection import Listener
>>> Listener(r'\\.\test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.2/multiprocessing/connection.py", line 130, in __init__
    self._listener = PipeListener(address, backlog)
NameError: global name 'PipeListener' is not defined
>>>


I've attached a small patch for this issue.
msg157243 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-03-31 23:39
Thanks for the patch. I don't think it deserves to be a public API (it could be a private function, i.e. starting with an underscore).
Also, it's better if you can add a test (to Lib/test/test_multiprocessing.py) checking that ValueError is raised when applicable.
msg157298 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2012-04-01 15:15
Here are the two diffs. Hope they are good this time.
msg157300 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-01 15:30
New changeset 273d7502ced1 by Antoine Pitrou in branch '3.2':
Issue #14151: Raise a ValueError, not a NameError, when trying to create
http://hg.python.org/cpython/rev/273d7502ced1

New changeset 42b29aea1c98 by Antoine Pitrou in branch 'default':
Issue #14151: Raise a ValueError, not a NameError, when trying to create
http://hg.python.org/cpython/rev/42b29aea1c98
msg157301 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-04-01 15:32
Thank you!
For the record, the recommended workflow to produce patches is to use Mercurial: see http://docs.python.org/devguide/setup.html#getting-the-source-code
so that you only have to type e.g. "hg diff" to get a diff of all your local changes.
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58359
2012-04-01 15:32:20pitrousetstatus: open -> closed
resolution: fixed
stage: resolved
2012-04-01 15:32:03pitrousetmessages: + msg157301
2012-04-01 15:30:59python-devsetnosy: + python-dev
messages: + msg157300
2012-04-01 15:15:59Claudiu.Popasetfiles: + test_multiprocessing.diff
2012-04-01 15:15:45Claudiu.Popasetfiles: + connection.diff

messages: + msg157298
2012-03-31 23:39:07pitrousetnosy: + pitrou

messages: + msg157243
versions: + Python 3.3
2012-02-28 13:51:37Claudiu.Popacreate