[Python-checkins] bpo-45975: IDLE - Remove extraneous parens (GH-31107)

miss-islington webhook-mailer at python.org
Thu Feb 3 15:44:20 EST 2022


https://github.com/python/cpython/commit/63523e7b2a631f28134b25a8063d50e08c741db6
commit: 63523e7b2a631f28134b25a8063d50e08c741db6
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-03T12:44:11-08:00
summary:

bpo-45975: IDLE - Remove extraneous parens (GH-31107)


mistakenly included in 3 files in previous PR
and backported both to 3.10 and 3.9.
(cherry picked from commit 916d0d822c79933f4c420f7a36f16f3eb788646b)

Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>

files:
M Lib/idlelib/pyparse.py
M Lib/idlelib/replace.py
M Lib/idlelib/run.py

diff --git a/Lib/idlelib/pyparse.py b/Lib/idlelib/pyparse.py
index a94327533d865..8545c63e1435d 100644
--- a/Lib/idlelib/pyparse.py
+++ b/Lib/idlelib/pyparse.py
@@ -179,7 +179,7 @@ def find_good_parse_start(self, is_char_in_string):
         # Peeking back worked; look forward until _synchre no longer
         # matches.
         i = pos + 1
-        while (m := _synchre(code, i)):
+        while m := _synchre(code, i):
             s, i = m.span()
             if not is_char_in_string(s):
                 pos = s
diff --git a/Lib/idlelib/replace.py b/Lib/idlelib/replace.py
index ac04ed94dd475..ca83173877ad1 100644
--- a/Lib/idlelib/replace.py
+++ b/Lib/idlelib/replace.py
@@ -158,8 +158,8 @@ def replace_all(self, event=None):
         first = last = None
         # XXX ought to replace circular instead of top-to-bottom when wrapping
         text.undo_block_start()
-        while (res := self.engine.search_forward(
-                text, prog, line, col, wrap=False, ok=ok)):
+        while res := self.engine.search_forward(
+                text, prog, line, col, wrap=False, ok=ok):
             line, m = res
             chars = text.get("%d.0" % line, "%d.0" % (line+1))
             orig = m.group()
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 01f8d65426abc..aaa9b5ce8d181 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -482,7 +482,7 @@ def read(self, size=-1):
         result = self._line_buffer
         self._line_buffer = ''
         if size < 0:
-            while (line := self.shell.readline()):
+            while line := self.shell.readline():
                 result += line
         else:
             while len(result) < size:



More information about the Python-checkins mailing list