From: Thomas Kluyver Date: Wed, 7 Dec 2016 10:14:05 +0000 (+0100) Subject: Use errno_from_exception on error caught in Waker X-Git-Tag: v4.5.0~52^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1908%2Fhead;p=thirdparty%2Ftornado.git Use errno_from_exception on error caught in Waker Addresses part of gh-1907 --- diff --git a/tornado/platform/common.py b/tornado/platform/common.py index 2d4065ca6..d78ee6866 100644 --- a/tornado/platform/common.py +++ b/tornado/platform/common.py @@ -6,7 +6,7 @@ import socket import time from tornado.platform import interface - +from tornado.util import errno_from_exception def try_close(f): # Avoid issue #875 (race condition when using the file in another @@ -61,7 +61,7 @@ class Waker(interface.Waker): break # success except socket.error as detail: if (not hasattr(errno, 'WSAEADDRINUSE') or - detail[0] != errno.WSAEADDRINUSE): + errno_from_exception(detail) != errno.WSAEADDRINUSE): # "Address already in use" is the only error # I've seen on two WinXP Pro SP2 boxes, under # Pythons 2.3.5 and 2.4.1.