bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)

(cherry picked from commit 51a95be1d0)

Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-02-02 18:28:52 -08:00 committed by GitHub
parent 5765eaa136
commit 2ddc278875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 24 deletions

View file

@ -179,14 +179,10 @@ class Parser:
# Peeking back worked; look forward until _synchre no longer
# matches.
i = pos + 1
while 1:
m = _synchre(code, i)
if m:
s, i = m.span()
if not is_char_in_string(s):
pos = s
else:
break
while (m := _synchre(code, i)):
s, i = m.span()
if not is_char_in_string(s):
pos = s
return pos
def set_lo(self, lo):