summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/pyparse.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-02-03 02:28:52 (GMT)
committerGitHub <noreply@github.com>2022-02-03 02:28:52 (GMT)
commit2ddc278875f789de622262ee8ff5a1c3788f031c (patch)
treea980bdaaddc7caa6d6006f0590ab7b67ad65decd /Lib/idlelib/pyparse.py
parent5765eaa13654e5f812a286700da7d6b8e144da0e (diff)
downloadcpython-2ddc278875f789de622262ee8ff5a1c3788f031c.zip
cpython-2ddc278875f789de622262ee8ff5a1c3788f031c.tar.gz
cpython-2ddc278875f789de622262ee8ff5a1c3788f031c.tar.bz2
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)
(cherry picked from commit 51a95be1d035a717ab29e98056b8831a98e61125) Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
Diffstat (limited to 'Lib/idlelib/pyparse.py')
-rw-r--r--Lib/idlelib/pyparse.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/idlelib/pyparse.py b/Lib/idlelib/pyparse.py
index d34872b..a943275 100644
--- a/Lib/idlelib/pyparse.py
+++ b/Lib/idlelib/pyparse.py
@@ -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):