mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Convert a pile of obvious "yes/no" functions to return bool.
This commit is contained in:
parent
2f486b7fa6
commit
bc0e910826
34 changed files with 117 additions and 122 deletions
|
@ -66,7 +66,7 @@ class InteractiveInterpreter:
|
|||
object. The code is executed by calling self.runcode() (which
|
||||
also handles run-time exceptions, except for SystemExit).
|
||||
|
||||
The return value is 1 in case 2, 0 in the other cases (unless
|
||||
The return value is True in case 2, False in the other cases (unless
|
||||
an exception is raised). The return value can be used to
|
||||
decide whether to use sys.ps1 or sys.ps2 to prompt the next
|
||||
line.
|
||||
|
@ -77,15 +77,15 @@ class InteractiveInterpreter:
|
|||
except (OverflowError, SyntaxError, ValueError):
|
||||
# Case 1
|
||||
self.showsyntaxerror(filename)
|
||||
return 0
|
||||
return False
|
||||
|
||||
if code is None:
|
||||
# Case 2
|
||||
return 1
|
||||
return True
|
||||
|
||||
# Case 3
|
||||
self.runcode(code)
|
||||
return 0
|
||||
return False
|
||||
|
||||
def runcode(self, code):
|
||||
"""Execute a code object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue