bpo-45975: Simplify some while-loops with walrus operator (GH-29347)

This commit is contained in:
Nick Drozd 2022-11-26 16:33:25 -06:00 committed by GitHub
parent 25bc115df9
commit 024ac542d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 41 additions and 153 deletions

View file

@ -566,10 +566,7 @@ class ElementTree:
# it with chunks.
self._root = parser._parse_whole(source)
return self._root
while True:
data = source.read(65536)
if not data:
break
while data := source.read(65536):
parser.feed(data)
self._root = parser.close()
return self._root