diff options
Diffstat (limited to 'Lib/asyncore.py')
-rw-r--r-- | Lib/asyncore.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index d379ba8..909d9f6 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -54,7 +54,7 @@ import warnings import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \ - ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \ + ENOTCONN, ESHUTDOWN, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, \ errorcode _DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, @@ -143,11 +143,8 @@ def poll(timeout=0.0, map=None): try: r, w, e = select.select(r, w, e, timeout) - except select.error as err: - if err.args[0] != EINTR: - raise - else: - return + except InterruptedError: + return for fd in r: obj = map.get(fd) @@ -184,15 +181,10 @@ def poll2(timeout=0.0, map=None): if obj.writable() and not obj.accepting: flags |= select.POLLOUT if flags: - # Only check for exceptions if object was either readable - # or writable. - flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL pollster.register(fd, flags) try: r = pollster.poll(timeout) - except select.error as err: - if err.args[0] != EINTR: - raise + except InterruptedError: r = [] for fd, flags in r: obj = map.get(fd) @@ -292,7 +284,7 @@ class dispatcher: del map[fd] self._fileno = None - def create_socket(self, family, type): + def create_socket(self, family=socket.AF_INET, type=socket.SOCK_STREAM): self.family_and_type = family, type sock = socket.socket(family, type) sock.setblocking(0) |