Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c73e8e

Browse files
committed
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.
2 parents 395c879 + 6d20cba commit 5c73e8e

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/multiprocessing/connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def _validate_family(family):
111111
if sys.platform != 'win32' and family == 'AF_PIPE':
112112
raise ValueError('Family %s is not recognized.' % family)
113113

114+
if sys.platform == 'win32' and family == 'AF_UNIX':
115+
# double check
116+
if not hasattr(socket, family):
117+
raise ValueError('Family %s is not recognized.' % family)
114118

115119
def address_type(address):
116120
'''

Lib/test/test_multiprocessing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,10 @@ def test_invalid_family(self):
26492649
with self.assertRaises(ValueError):
26502650
multiprocessing.connection.Listener(r'\\.\test')
26512651

2652+
@unittest.skipUnless(WIN32, "skipped on non-Windows platforms")
2653+
def test_invalid_family_win32(self):
2654+
with self.assertRaises(ValueError):
2655+
multiprocessing.connection.Listener('/var/test.pipe')
26522656

26532657
testcases_other = [OtherTest, TestInvalidHandle, TestInitializers,
26542658
TestStdinBadfiledescriptor, TestWait, TestInvalidFamily]

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Core and Builtins
1919
Library
2020
-------
2121

22+
- Issue #14482: Raise a ValueError, not a NameError, when trying to create
23+
a multiprocessing Client or Listener with an AF_UNIX type address under
24+
Windows. Patch by Popa Claudiu.
25+
2226
- Issue #802310: Generate always unique tkinter font names if not directly passed.
2327

2428
- Issue #14151: Raise a ValueError, not a NameError, when trying to create

0 commit comments

Comments
 (0)