summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2022-01-17 15:37:51 -0600
committerGitHub <noreply@github.com>2022-01-17 15:37:51 -0600
commit640c9afec78876115e9a7f9fd9a331129ab58836 (patch)
tree492b15a22f86194dc450e76bcee261eb9d6c9203
parenta1868227405062b3daec28362cbaf071d26df2f3 (diff)
parentfaec8a27d79bd45110933a63ec3c8cb22968fd6d (diff)
downloadwaitress-640c9afec78876115e9a7f9fd9a331129ab58836.tar.gz
Merge pull request #361 from Pylons/bugfix/winerror-windows
Bugfix on Windows: OSError is not subscriptable
-rw-r--r--CHANGES.txt6
-rw-r--r--src/waitress/trigger.py2
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c45356e..56e3340 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,12 @@ Next Release
Bugfix
~~~~~~
+- In Python 3 ``OSError`` is no longer subscriptable, this caused failures on
+ Windows attempting to loop to find an socket that would work for use in the
+ trigger.
+
+ See https://github.com/Pylons/waitress/pull/361
+
- Fixed an issue whereby ``BytesIO`` objects were not properly closed, and
thereby would not get cleaned up until garbage collection would get around to
it.
diff --git a/src/waitress/trigger.py b/src/waitress/trigger.py
index 3b1ad46..49b2034 100644
--- a/src/waitress/trigger.py
+++ b/src/waitress/trigger.py
@@ -173,7 +173,7 @@ else: # pragma: no cover
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.