[Python-checkins] cpython (2.7): Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.

charles-francois.natali python-checkins at python.org
Thu Jul 14 19:49:16 CEST 2011


http://hg.python.org/cpython/rev/16bc59d37866
changeset:   71333:16bc59d37866
branch:      2.7
parent:      71326:d3cebbd500aa
user:        Charles-François Natali <neologix at free.fr>
date:        Thu Jul 14 19:49:02 2011 +0200
summary:
  Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.

files:
  Lib/asyncore.py |  6 ++++--
  Misc/NEWS       |  2 ++
  2 files changed, 6 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncore.py b/Lib/asyncore.py
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -132,7 +132,8 @@
             is_w = obj.writable()
             if is_r:
                 r.append(fd)
-            if is_w:
+            # accepting sockets should not be writable
+            if is_w and not obj.accepting:
                 w.append(fd)
             if is_r or is_w:
                 e.append(fd)
@@ -179,7 +180,8 @@
             flags = 0
             if obj.readable():
                 flags |= select.POLLIN | select.POLLPRI
-            if obj.writable():
+            # accepting sockets should not be writable
+            if obj.writable() and not obj.accepting:
                 flags |= select.POLLOUT
             if flags:
                 # Only check for exceptions if object was either readable
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,8 @@
 Library
 -------
 
+- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
+
 - Issue #4376: ctypes now supports nested structures in a endian different than
   the parent structure. Patch by Vlad Riscutia.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list