mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
bpo-36958: In IDLE, print exit message (GH-13435)
Print any argument other than None or int passed to SystemExit or sys.exit().
This commit is contained in:
parent
53d378c812
commit
6d965b39b7
5 changed files with 20 additions and 6 deletions
|
@ -700,6 +700,9 @@ If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``,
|
||||||
IDLE's changes are lost and input from the keyboard and output to the screen
|
IDLE's changes are lost and input from the keyboard and output to the screen
|
||||||
will not work correctly.
|
will not work correctly.
|
||||||
|
|
||||||
|
When user code raises SystemExit either directly or by calling sys.exit, IDLE
|
||||||
|
returns to a Shell prompt instead of exiting.
|
||||||
|
|
||||||
User output in Shell
|
User output in Shell
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,12 @@ Released on 2019-10-20?
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
|
|
||||||
|
bpo-36958: Print any argument other than None or int passed to
|
||||||
|
SystemExit or sys.exit().
|
||||||
|
|
||||||
|
bpo-36807: When saving a file, call file.flush() and os.fsync()
|
||||||
|
so bits are flushed to e.g. a USB drive.
|
||||||
|
|
||||||
bpo-36429: Fix starting IDLE with pyshell.
|
bpo-36429: Fix starting IDLE with pyshell.
|
||||||
Add idlelib.pyshell alias at top; remove pyshell alias at bottom.
|
Add idlelib.pyshell alias at top; remove pyshell alias at bottom.
|
||||||
Remove obsolete __name__=='__main__' command.
|
Remove obsolete __name__=='__main__' command.
|
||||||
|
|
|
@ -659,6 +659,8 @@ will then be attached to that window for input and output.</p>
|
||||||
<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
|
<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
|
||||||
IDLE’s changes are lost and input from the keyboard and output to the screen
|
IDLE’s changes are lost and input from the keyboard and output to the screen
|
||||||
will not work correctly.</p>
|
will not work correctly.</p>
|
||||||
|
<p>When user code raises SystemExit either directly or by calling sys.exit, IDLE
|
||||||
|
returns to a Shell prompt instead of exiting.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="user-output-in-shell">
|
<div class="section" id="user-output-in-shell">
|
||||||
<h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this headline">¶</a></h3>
|
<h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this headline">¶</a></h3>
|
||||||
|
@ -941,7 +943,7 @@ also used for testing.</p>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
Last updated on May 16, 2019.
|
Last updated on May 19, 2019.
|
||||||
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
|
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
@ -474,15 +474,16 @@ class Executive(object):
|
||||||
exec(code, self.locals)
|
exec(code, self.locals)
|
||||||
finally:
|
finally:
|
||||||
interruptable = False
|
interruptable = False
|
||||||
except SystemExit:
|
except SystemExit as e:
|
||||||
# Scripts that raise SystemExit should just
|
if e.args: # SystemExit called with an argument.
|
||||||
# return to the interactive prompt
|
ob = e.args[0]
|
||||||
pass
|
if not isinstance(ob, (type(None), int)):
|
||||||
|
print('SystemExit: ' + str(ob), file=sys.stderr)
|
||||||
|
# Return to the interactive prompt.
|
||||||
except:
|
except:
|
||||||
self.usr_exc_info = sys.exc_info()
|
self.usr_exc_info = sys.exc_info()
|
||||||
if quitting:
|
if quitting:
|
||||||
exit()
|
exit()
|
||||||
# even print a user code SystemExit exception, continue
|
|
||||||
print_exception()
|
print_exception()
|
||||||
jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
|
jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
|
||||||
if jit:
|
if jit:
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Print any argument other than None or int passed to SystemExit or
|
||||||
|
sys.exit().
|
Loading…
Add table
Add a link
Reference in a new issue