From: John Bampton Date: Sun, 6 Oct 2019 02:44:52 +0000 (+1000) Subject: Simplify chained comparison. X-Git-Tag: v6.1.0b1~54^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed1c34fde355a6a5028afbc2c550143dd2131d3e;p=thirdparty%2Ftornado.git Simplify chained comparison. --- 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 )