summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/pyparse.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2022-02-03 01:59:24 (GMT)
committerGitHub <noreply@github.com>2022-02-03 01:59:24 (GMT)
commit51a95be1d035a717ab29e98056b8831a98e61125 (patch)
treee50beac085f7ae2fb5bac1104571804aa93e0053 /Lib/idlelib/pyparse.py
parent164a017e13ee96bd1ea1ae79f5ac9e25fe83994e (diff)
downloadcpython-51a95be1d035a717ab29e98056b8831a98e61125.zip
cpython-51a95be1d035a717ab29e98056b8831a98e61125.tar.gz
cpython-51a95be1d035a717ab29e98056b8831a98e61125.tar.bz2
bpo-45975: Use walrus operator for some idlelib while loops (GH-31083)
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):