]> granicus.if.org Git - python/commitdiff
Issue #16955: Fix the poll() method for multiprocessing's socket
authorRichard Oudkerk <shibturn@gmail.com>
Sun, 13 Jan 2013 22:46:48 +0000 (22:46 +0000)
committerRichard Oudkerk <shibturn@gmail.com>
Sun, 13 Jan 2013 22:46:48 +0000 (22:46 +0000)
connections on Windows.

Lib/multiprocessing/connection.py
Lib/test/test_multiprocessing.py
Misc/NEWS

index 2ae8a811f16b6b084e51276fbafa7572e2c834d3..25b0326333e28901b5166344055219a7320b6442 100644 (file)
@@ -405,7 +405,7 @@ class Connection(_ConnectionBase):
         return self._recv(size)
 
     def _poll(self, timeout):
-        r = wait([self._handle], timeout)
+        r = wait([self], timeout)
         return bool(r)
 
 
index 533dbacc8f77cd3c2c7783c2910789d684b24fef..bb09638d8c6c4a1b609bc9dced92194cc52a2e7b 100644 (file)
@@ -2383,6 +2383,17 @@ class _TestListenerClient(BaseTestCase):
         p.join()
         l.close()
 
+    def test_issue16955(self):
+        for fam in self.connection.families:
+            l = self.connection.Listener(family=fam)
+            c = self.connection.Client(l.address)
+            a = l.accept()
+            a.send_bytes(b"hello")
+            self.assertTrue(c.poll(1))
+            a.close()
+            c.close()
+            l.close()
+
 class _TestPoll(unittest.TestCase):
 
     ALLOWED_TYPES = ('processes', 'threads')
index d09406bb155ba36be9eb79e169084b45c81a97cb..c444ed66b70bcb7171cdacc3d4450ec5e73997eb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -147,6 +147,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #16955: Fix the poll() method for multiprocessing's socket
+  connections on Windows.
+
 - SSLContext.load_dh_params() now properly closes the input file.
 
 - Issue #16829: IDLE printing no longer fails if there are spaces or other