diff options
author | Nick Drozd <nicholasdrozd@gmail.com> | 2022-11-26 22:33:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-26 22:33:25 (GMT) |
commit | 024ac542d738f56b36bdeb3517a10e93da5acab9 (patch) | |
tree | 7e54e0fcc68871e059ccff2adaf39b8a1808dcad /Lib/wsgiref | |
parent | 25bc115df9d0e82309852609a83b5ab7f804cdc1 (diff) | |
download | cpython-024ac542d738f56b36bdeb3517a10e93da5acab9.zip cpython-024ac542d738f56b36bdeb3517a10e93da5acab9.tar.gz cpython-024ac542d738f56b36bdeb3517a10e93da5acab9.tar.bz2 |
bpo-45975: Simplify some while-loops with walrus operator (GH-29347)
Diffstat (limited to 'Lib/wsgiref')
-rw-r--r-- | Lib/wsgiref/handlers.py | 5 | ||||
-rw-r--r-- | Lib/wsgiref/validate.py | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py index cd0916d..cafe872 100644 --- a/Lib/wsgiref/handlers.py +++ b/Lib/wsgiref/handlers.py @@ -475,10 +475,7 @@ class SimpleHandler(BaseHandler): from warnings import warn warn("SimpleHandler.stdout.write() should not do partial writes", DeprecationWarning) - while True: - data = data[result:] - if not data: - break + while data := data[result:]: result = self.stdout.write(data) def _flush(self): diff --git a/Lib/wsgiref/validate.py b/Lib/wsgiref/validate.py index 6044e32..1a1853c 100644 --- a/Lib/wsgiref/validate.py +++ b/Lib/wsgiref/validate.py @@ -214,10 +214,7 @@ class InputWrapper: return lines def __iter__(self): - while 1: - line = self.readline() - if not line: - return + while line := self.readline(): yield line def close(self): |