summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
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/xml/sax
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/xml/sax')
-rw-r--r--Lib/xml/sax/xmlreader.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/xml/sax/xmlreader.py b/Lib/xml/sax/xmlreader.py
index 716f228..e906121 100644
--- a/Lib/xml/sax/xmlreader.py
+++ b/Lib/xml/sax/xmlreader.py
@@ -120,10 +120,8 @@ class IncrementalParser(XMLReader):
file = source.getCharacterStream()
if file is None:
file = source.getByteStream()
- buffer = file.read(self._bufsize)
- while buffer:
+ while buffer := file.read(self._bufsize):
self.feed(buffer)
- buffer = file.read(self._bufsize)
self.close()
def feed(self, data):