From b4b245131f5b7a7fad1fc1fca37ca45fa9e2e087 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Wed, 7 Dec 2016 11:14:05 +0100 Subject: [PATCH] Use errno_from_exception on error caught in Waker Addresses part of gh-1907 --- tornado/platform/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tornado/platform/common.py b/tornado/platform/common.py index 2d4065ca63..d78ee6866b 100644 --- a/tornado/platform/common.py +++ b/tornado/platform/common.py @@ -6,7 +6,7 @@ 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 @@ def __init__(self): 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.