Skip to content

Commit 6a15f91

Browse files
authored
idlelib: replace 'while 1' with 'while True' (#94827)
1 parent 967da5f commit 6a15f91

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Lib/idlelib/editor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ def smart_backspace_event(self, event):
13011301
want = ((have - 1) // self.indentwidth) * self.indentwidth
13021302
# Debug prompt is multilined....
13031303
ncharsdeleted = 0
1304-
while 1:
1304+
while True:
13051305
chars = chars[:-1]
13061306
ncharsdeleted = ncharsdeleted + 1
13071307
have = len(chars.expandtabs(tabwidth))

Lib/idlelib/history.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def fetch(self, reverse):
6565
self.text.bell()
6666
return
6767
nprefix = len(prefix)
68-
while 1:
68+
while True:
6969
pointer += -1 if reverse else 1
7070
if pointer < 0 or pointer >= nhist:
7171
self.text.bell()

Lib/idlelib/hyperparser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ def get_expression(self):
237237
last_identifier_pos = pos
238238
postdot_phase = True
239239

240-
while 1:
240+
while True:
241241
# Eat whitespaces, comments, and if postdot_phase is False - a dot
242-
while 1:
242+
while True:
243243
if pos>brck_limit and rawtext[pos-1] in self._whitespace_chars:
244244
# Eat a whitespace
245245
pos -= 1

Lib/idlelib/rpc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _getresponse(self, myseq, wait):
307307
self.debug("_getresponse:myseq:", myseq)
308308
if threading.current_thread() is self.sockthread:
309309
# this thread does all reading of requests or responses
310-
while 1:
310+
while True:
311311
response = self.pollresponse(myseq, wait)
312312
if response is not None:
313313
return response
@@ -417,7 +417,7 @@ def pollresponse(self, myseq, wait):
417417
self.responses and notify the owning thread.
418418
419419
"""
420-
while 1:
420+
while True:
421421
# send queued response if there is one available
422422
try:
423423
qmsg = response_queue.get(0)

Lib/idlelib/run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def main(del_exitfunc=False):
145145
args=((LOCALHOST, port),))
146146
sockthread.daemon = True
147147
sockthread.start()
148-
while 1:
148+
while True:
149149
try:
150150
if exit_now:
151151
try:

Lib/idlelib/searchengine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def search_backward(self, text, prog, line, col, wrap, ok=0):
165165
wrapped = 0
166166
startline = line
167167
chars = text.get("%d.0" % line, "%d.0" % (line+1))
168-
while 1:
168+
while True:
169169
m = search_reverse(prog, chars[:-1], col)
170170
if m:
171171
if ok or m.start() < col:

0 commit comments

Comments
 (0)