[Python-checkins] idlelib: replace 'while 1' with 'while True' (GH-94827)
miss-islington
webhook-mailer at python.org
Wed Jul 13 21:33:38 EDT 2022
https://github.com/python/cpython/commit/29fc20cdc068b1d744371d3e5a0e87b1dc7b73e5
commit: 29fc20cdc068b1d744371d3e5a0e87b1dc7b73e5
branch: 3.11
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-07-13T18:33:29-07:00
summary:
idlelib: replace 'while 1' with 'while True' (GH-94827)
(cherry picked from commit 6a15f918b5a6fb5113d5332ebf27df1d5360e66c)
Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
files:
M Lib/idlelib/editor.py
M Lib/idlelib/history.py
M Lib/idlelib/hyperparser.py
M Lib/idlelib/rpc.py
M Lib/idlelib/run.py
M Lib/idlelib/searchengine.py
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 6c52efd655e12..859a288b4bc67 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -1301,7 +1301,7 @@ def smart_backspace_event(self, event):
want = ((have - 1) // self.indentwidth) * self.indentwidth
# Debug prompt is multilined....
ncharsdeleted = 0
- while 1:
+ while True:
chars = chars[:-1]
ncharsdeleted = ncharsdeleted + 1
have = len(chars.expandtabs(tabwidth))
diff --git a/Lib/idlelib/history.py b/Lib/idlelib/history.py
index 100f505256a94..5a9b32aaf6bb8 100644
--- a/Lib/idlelib/history.py
+++ b/Lib/idlelib/history.py
@@ -65,7 +65,7 @@ def fetch(self, reverse):
self.text.bell()
return
nprefix = len(prefix)
- while 1:
+ while True:
pointer += -1 if reverse else 1
if pointer < 0 or pointer >= nhist:
self.text.bell()
diff --git a/Lib/idlelib/hyperparser.py b/Lib/idlelib/hyperparser.py
index 77baca782b3fd..76144ee8fb30f 100644
--- a/Lib/idlelib/hyperparser.py
+++ b/Lib/idlelib/hyperparser.py
@@ -237,9 +237,9 @@ def get_expression(self):
last_identifier_pos = pos
postdot_phase = True
- while 1:
+ while True:
# Eat whitespaces, comments, and if postdot_phase is False - a dot
- while 1:
+ while True:
if pos>brck_limit and rawtext[pos-1] in self._whitespace_chars:
# Eat a whitespace
pos -= 1
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index 8efcf048fa3aa..62eec84c9c8d0 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -307,7 +307,7 @@ def _getresponse(self, myseq, wait):
self.debug("_getresponse:myseq:", myseq)
if threading.current_thread() is self.sockthread:
# this thread does all reading of requests or responses
- while 1:
+ while True:
response = self.pollresponse(myseq, wait)
if response is not None:
return response
@@ -417,7 +417,7 @@ def pollresponse(self, myseq, wait):
self.responses and notify the owning thread.
"""
- while 1:
+ while True:
# send queued response if there is one available
try:
qmsg = response_queue.get(0)
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index aaa9b5ce8d181..577c49eb67b20 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -145,7 +145,7 @@ def main(del_exitfunc=False):
args=((LOCALHOST, port),))
sockthread.daemon = True
sockthread.start()
- while 1:
+ while True:
try:
if exit_now:
try:
diff --git a/Lib/idlelib/searchengine.py b/Lib/idlelib/searchengine.py
index eddef581ab40a..0684142f43644 100644
--- a/Lib/idlelib/searchengine.py
+++ b/Lib/idlelib/searchengine.py
@@ -165,7 +165,7 @@ def search_backward(self, text, prog, line, col, wrap, ok=0):
wrapped = 0
startline = line
chars = text.get("%d.0" % line, "%d.0" % (line+1))
- while 1:
+ while True:
m = search_reverse(prog, chars[:-1], col)
if m:
if ok or m.start() < col:
More information about the Python-checkins
mailing list