From ed1c34fde355a6a5028afbc2c550143dd2131d3e Mon Sep 17 00:00:00 2001 From: John Bampton Date: Sun, 6 Oct 2019 12:44:52 +1000 Subject: [PATCH] Simplify chained comparison. --- tornado/http1connection.py | 2 +- tornado/web.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tornado/http1connection.py b/tornado/http1connection.py index 9b40fd653..826f6f304 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -235,7 +235,7 @@ class HTTP1Connection(httputil.HTTPConnection): # but do not actually have a body. # http://tools.ietf.org/html/rfc7230#section-3.3 skip_body = True - if code >= 100 and code < 200: + if 100 <= code < 200: # 1xx responses should never indicate the presence of # a body. if "Content-Length" in headers or "Transfer-Encoding" in headers: diff --git a/tornado/web.py b/tornado/web.py index adbf591e5..751ed1e41 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1132,9 +1132,7 @@ class RequestHandler(object): if self.check_etag_header(): self._write_buffer = [] self.set_status(304) - if self._status_code in (204, 304) or ( - self._status_code >= 100 and self._status_code < 200 - ): + if self._status_code in (204, 304) or (100 <= self._status_code < 200): assert not self._write_buffer, ( "Cannot send body with %s" % self._status_code ) -- 2.47.2