Author sbt
Recipients Erez.Sh, William.Edwards, asksol, danken, dmalcolm, giampaolo.rodola, jnoller, neologix, pitrou, python-dev, sbt, synapse, vstinner
Date 2013-01-14.00:32:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1358123563.59.0.895344659558.issue10527@psf.upfronthosting.co.za>
In-reply-to
Content
It looks like the change to multiprocessing/connection.py committed does not match the one uploaded as issue10527-3.patch

changeset 81174:e971a70984b8
     1.1 --- a/Lib/multiprocessing/connection.py
     1.2 +++ b/Lib/multiprocessing/connection.py
     1.3 @@ -509,6 +509,27 @@ if sys.platform != 'win32':
     1.4          return c1, c2
     1.5  
     1.6  else:
     1.7 +    if hasattr(select, 'poll'):
     1.8 +        def _poll(fds, timeout):
     1.9 +            if timeout is not None:
    1.10 +                timeout = int(timeout) * 1000  # timeout is in milliseconds
    1.11 +            fd_map = {}
    1.12 +            pollster = select.poll()
    1.13 +            for fd in fds:
    1.14 +                pollster.register(fd, select.POLLIN)
    1.15 +                if hasattr(fd, 'fileno'):
    1.16 +                    fd_map[fd.fileno()] = fd
    1.17 +                else:
    1.18 +                    fd_map[fd] = fd
    1.19 +            ls = []
    1.20 +            for fd, event in pollster.poll(timeout):
    1.21 +                if event & select.POLLNVAL:
    1.22 +                    raise ValueError('invalid file descriptor %i' % fd)
    1.23 +                ls.append(fd_map[fd])
    1.24 +            return ls
    1.25 +    else:
    1.26 +        def _poll(fds, timeout):
    1.27 +            return select.select(fds, [], [], timeout)[0]
    1.28  
    1.29      def Pipe(duplex=True):
    1.30          '''

issue10527-3.patch:
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -861,6 +861,27 @@
         return [o for o in object_list if o in ready_objects]
 
 else:
+    if hasattr(select, 'poll'):
+        def _poll(fds, timeout):
+            if timeout is not None:
+                timeout = int(timeout) * 1000  # timeout is in milliseconds
+            fd_map = {}
+            pollster = select.poll()
+            for fd in fds:
+                pollster.register(fd, select.POLLIN)
+                if hasattr(fd, 'fileno'):
+                    fd_map[fd.fileno()] = fd
+                else:
+                    fd_map[fd] = fd
+            ls = []
+            for fd, event in pollster.poll(timeout):
+                if event & select.POLLNVAL:
+                    raise ValueError('invalid file descriptor %i' % fd)
+                ls.append(fd_map[fd])
+            return ls
+    else:
+        def _poll(fds, timeout):
+            return select.select(fds, [], [], timeout)[0]
 
     def wait(object_list, timeout=None):
         '''
@@ -870,12 +891,12 @@
         '''
         if timeout is not None:
             if timeout <= 0:
-                return select.select(object_list, [], [], 0)[0]
+                return _poll(object_list, 0)
             else:
                 deadline = time.time() + timeout
         while True:
             try:
-                return select.select(object_list, [], [], timeout)[0]
+                return _poll(object_list, timeout)
             except OSError as e:
                 if e.errno != errno.EINTR:
                     raise
History
Date User Action Args
2013-01-14 00:32:43sbtsetrecipients: + sbt, pitrou, vstinner, giampaolo.rodola, jnoller, synapse, asksol, dmalcolm, neologix, danken, Erez.Sh, python-dev, William.Edwards
2013-01-14 00:32:43sbtsetmessageid: <1358123563.59.0.895344659558.issue10527@psf.upfronthosting.co.za>
2013-01-14 00:32:43sbtlinkissue10527 messages
2013-01-14 00:32:41sbtcreate