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

@ -224,9 +224,7 @@ class Unpacker:
def unpack_list(self, unpack_item):
list = []
while 1:
x = self.unpack_uint()
if x == 0: break
while (x := self.unpack_uint()) != 0:
if x != 1:
raise ConversionError('0 or 1 expected, got %r' % (x,))
item = unpack_item()