summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2022-01-17 00:01:29 -0700
committerBert JW Regeer <bertjw@regeer.org>2022-01-17 00:01:29 -0700
commite47586eaf6a3d5a9dba76de713a63c386545c903 (patch)
tree52db1431cd5027a38ab9bd70faf1806bf38e1871
parentf41e59826c81d7da5309e4b3694d5ac7a8bbd626 (diff)
downloadwaitress-bugfix/winerror-windows.tar.gz
Bugfix on Windows: OSError is not subscriptablebugfix/winerror-windows
When Waitress fails to launch on Windows due to an issue with the trigger socket not being ready for connections, we attempt to loop. In the past this was done by subscripting the OSError and checking to see if it matched errno.WSAEADDRINUSE, this is no longer possible in newer verisons of Python. This is a quick bugfix for a rare case which should no longer happen on Windows.
-rw-r--r--src/waitress/trigger.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/waitress/trigger.py b/src/waitress/trigger.py
index 24c4d0d..4fc2643 100644
--- a/src/waitress/trigger.py
+++ b/src/waitress/trigger.py
@@ -174,7 +174,7 @@ else: # pragma: no cover
w.connect(connect_address)
break # success
except OSError as detail:
- if detail[0] != errno.WSAEADDRINUSE:
+ if getattr('winerror', detail, None) != 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.