summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2020-03-28 16:51:21 (GMT)
committerGitHub <noreply@github.com>2020-03-28 16:51:21 (GMT)
commit34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120 (patch)
tree3916b88c0d70fe3ce0cfa0d64a4cd16dd1a52263 /Lib
parent34b0598295284e3ff6cedf5c05e159ce1fa54d60 (diff)
downloadcpython-34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120.zip
cpython-34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120.tar.gz
cpython-34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120.tar.bz2
bpo-38002: Use False/True for IDLE pyshell bools (GH-19203)
Change 0/1 assignments to 'executing', 'canceled', 'reading', 'endoffile'. These are not used outside of pyshell. Other bools already use False/True. Add comment about int needed for Windows call. Remove self.more, unused in idlelib and code.InteractiveInterpreter. The latter uses 'more' as a local.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/idlelib/pyshell.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index d5b310f..43fb597 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -16,7 +16,7 @@ except ImportError:
if sys.platform == 'win32':
try:
import ctypes
- PROCESS_SYSTEM_DPI_AWARE = 1
+ PROCESS_SYSTEM_DPI_AWARE = 1 # Int required.
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
except (ImportError, AttributeError, OSError):
pass
@@ -676,7 +676,6 @@ class ModifiedInterpreter(InteractiveInterpreter):
def runsource(self, source):
"Extend base class method: Stuff the source in the line cache first"
filename = self.stuffsource(source)
- self.more = 0
# at the moment, InteractiveInterpreter expects str
assert isinstance(source, str)
# InteractiveInterpreter.runsource() calls its runcode() method,
@@ -993,12 +992,12 @@ class PyShell(OutputWindow):
def beginexecuting(self):
"Helper for ModifiedInterpreter"
self.resetoutput()
- self.executing = 1
+ self.executing = True
def endexecuting(self):
"Helper for ModifiedInterpreter"
- self.executing = 0
- self.canceled = 0
+ self.executing = False
+ self.canceled = False
self.showprompt()
def close(self):
@@ -1075,7 +1074,7 @@ class PyShell(OutputWindow):
def readline(self):
save = self.reading
try:
- self.reading = 1
+ self.reading = True
self.top.mainloop() # nested mainloop()
finally:
self.reading = save
@@ -1087,11 +1086,11 @@ class PyShell(OutputWindow):
line = "\n"
self.resetoutput()
if self.canceled:
- self.canceled = 0
+ self.canceled = False
if not use_subprocess:
raise KeyboardInterrupt
if self.endoffile:
- self.endoffile = 0
+ self.endoffile = False
line = ""
return line
@@ -1109,8 +1108,8 @@ class PyShell(OutputWindow):
self.interp.write("KeyboardInterrupt\n")
self.showprompt()
return "break"
- self.endoffile = 0
- self.canceled = 1
+ self.endoffile = False
+ self.canceled = True
if (self.executing and self.interp.rpcclt):
if self.interp.getdebugger():
self.interp.restart_subprocess()
@@ -1130,8 +1129,8 @@ class PyShell(OutputWindow):
self.resetoutput()
self.close()
else:
- self.canceled = 0
- self.endoffile = 1
+ self.canceled = False
+ self.endoffile = True
self.top.quit()
return "break"
@@ -1303,7 +1302,7 @@ class PyShell(OutputWindow):
raise ###pass # ### 11Aug07 KBK if we are expecting exceptions
# let's find out what they are and be specific.
if self.canceled:
- self.canceled = 0
+ self.canceled = False
if not use_subprocess:
raise KeyboardInterrupt
return count