Skip to content

idlelib: replace 'while 1' with 'while True' #94827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/hyperparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Lib/idlelib/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/searchengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down