[Python-checkins] cpython (3.2): Issue #14482: Raise a ValueError, not a NameError, when trying to create
antoine.pitrou
python-checkins at python.org
Tue Apr 3 20:20:37 CEST 2012
http://hg.python.org/cpython/rev/57c0867fbf30
changeset: 76096:57c0867fbf30
branch: 3.2
parent: 76094:e5f5652bfe91
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Apr 03 20:12:23 2012 +0200
summary:
Issue #14482: Raise a ValueError, not a NameError, when trying to create
a multiprocessing Client or Listener with an AF_UNIX type address under
Windows. Patch by Popa Claudiu.
files:
Lib/multiprocessing/connection.py | 4 ++++
Lib/test/test_multiprocessing.py | 6 ++++++
Misc/NEWS | 4 ++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -101,6 +101,10 @@
if sys.platform != 'win32' and family == 'AF_PIPE':
raise ValueError('Family %s is not recognized.' % family)
+ if sys.platform == 'win32' and family == 'AF_UNIX':
+ # double check
+ if not hasattr(socket, family):
+ raise ValueError('Family %s is not recognized.' % family)
def address_type(address):
'''
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -2331,6 +2331,12 @@
with self.assertRaises(ValueError):
multiprocessing.connection.Listener(r'\\.\test')
+ @unittest.skipUnless(WIN32, "skipped on non-Windows platforms")
+ def test_invalid_family_win32(self):
+ with self.assertRaises(ValueError):
+ multiprocessing.connection.Listener('/var/test.pipe')
+
+
testcases_other = [OtherTest, TestInvalidHandle, TestInitializers,
TestStdinBadfiledescriptor, TestInvalidFamily]
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -39,6 +39,10 @@
Library
-------
+- Issue #14482: Raise a ValueError, not a NameError, when trying to create
+ a multiprocessing Client or Listener with an AF_UNIX type address under
+ Windows. Patch by Popa Claudiu.
+
- 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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list