Skip to content

Commit 062b0b0

Browse files
committed
Revert IDLE changes
1 parent 4a597aa commit 062b0b0

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

Lib/idlelib/idle_test/test_sidebar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ def get_shell_line_y_coords(self):
474474
index = text.index("@0,0")
475475
if index.split('.', 1)[1] != '0':
476476
index = text.index(f"{index} +1line linestart")
477-
while (lineinfo := text.dlineinfo(index)) is not None:
477+
while True:
478+
lineinfo = text.dlineinfo(index)
479+
if lineinfo is None:
480+
break
478481
y_coords.append(lineinfo[1])
479482
index = text.index(f"{index} +1line")
480483
return y_coords

Lib/idlelib/pyparse.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,14 @@ def find_good_parse_start(self, is_char_in_string):
179179
# Peeking back worked; look forward until _synchre no longer
180180
# matches.
181181
i = pos + 1
182-
while (m := _synchre(code, i)):
183-
s, i = m.span()
184-
if not is_char_in_string(s):
185-
pos = s
182+
while 1:
183+
m = _synchre(code, i)
184+
if m:
185+
s, i = m.span()
186+
if not is_char_in_string(s):
187+
pos = s
188+
else:
189+
break
186190
return pos
187191

188192
def set_lo(self, lo):

Lib/idlelib/replace.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def replace_all(self, event=None):
158158
first = last = None
159159
# XXX ought to replace circular instead of top-to-bottom when wrapping
160160
text.undo_block_start()
161-
while (res := self.engine.search_forward(
162-
text, prog, line, col, wrap=False, ok=ok)):
161+
while True:
162+
res = self.engine.search_forward(text, prog, line, col,
163+
wrap=False, ok=ok)
164+
if not res:
165+
break
163166
line, m = res
164167
chars = text.get("%d.0" % line, "%d.0" % (line+1))
165168
orig = m.group()

Lib/idlelib/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,9 @@ def read(self, size=-1):
482482
result = self._line_buffer
483483
self._line_buffer = ''
484484
if size < 0:
485-
while (line := self.shell.readline()):
485+
while True:
486+
line = self.shell.readline()
487+
if not line: break
486488
result += line
487489
else:
488490
while len(result) < size:

Lib/idlelib/sidebar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,10 @@ def update_sidebar(self):
471471
index = text.index("@0,0")
472472
if index.split('.', 1)[1] != '0':
473473
index = text.index(f'{index}+1line linestart')
474-
while (lineinfo := text.dlineinfo(index)) is not None:
474+
while True:
475+
lineinfo = text.dlineinfo(index)
476+
if lineinfo is None:
477+
break
475478
y = lineinfo[1]
476479
prev_newline_tagnames = text_tagnames(f"{index} linestart -1c")
477480
prompt = (

0 commit comments

Comments
 (0)