Skip to content

Commit

Permalink
Bugfix on Windows: OSError is not subscriptable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
digitalresistor committed Jan 17, 2022
1 parent a186822 commit e70fcea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/waitress/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __init__(self, map):
w.connect(connect_address)
break # success
except OSError as detail:
if detail[0] != errno.WSAEADDRINUSE:
if getattr(detail, 'winerror', 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.
Expand Down

0 comments on commit e70fcea

Please sign in to comment.