summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2022-11-26 22:33:25 (GMT)
committerGitHub <noreply@github.com>2022-11-26 22:33:25 (GMT)
commit024ac542d738f56b36bdeb3517a10e93da5acab9 (patch)
tree7e54e0fcc68871e059ccff2adaf39b8a1808dcad /Lib/_pyio.py
parent25bc115df9d0e82309852609a83b5ab7f804cdc1 (diff)
downloadcpython-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/_pyio.py')
-rw-r--r--Lib/_pyio.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 163cf9d..7f247ff 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -638,10 +638,7 @@ class RawIOBase(IOBase):
def readall(self):
"""Read until EOF, using multiple read() call."""
res = bytearray()
- while True:
- data = self.read(DEFAULT_BUFFER_SIZE)
- if not data:
- break
+ while data := self.read(DEFAULT_BUFFER_SIZE):
res += data
if res:
return bytes(res)