mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Patch #1540892: site.py Quitter() class attempts to close sys.stdin
before raising SystemExit, allowing IDLE to honor quit() and exit(). M Lib/site.py M Lib/idlelib/PyShell.py M Lib/idlelib/CREDITS.txt M Lib/idlelib/NEWS.txt M Misc/NEWS
This commit is contained in:
parent
798ed8f076
commit
d112bc7958
5 changed files with 24 additions and 11 deletions
|
@ -242,6 +242,12 @@ def setquit():
|
|||
def __repr__(self):
|
||||
return 'Use %s() or %s to exit' % (self.name, eof)
|
||||
def __call__(self, code=None):
|
||||
# Shells like IDLE catch the SystemExit, but listen when their
|
||||
# stdin wrapper is closed.
|
||||
try:
|
||||
sys.stdin.close()
|
||||
except:
|
||||
pass
|
||||
raise SystemExit(code)
|
||||
__builtin__.quit = Quitter('quit')
|
||||
__builtin__.exit = Quitter('exit')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue