summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2006-08-16 05:01:42 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2006-08-16 05:01:42 (GMT)
commitd112bc7958151fa17c4ccb27413c43e45b8476fb (patch)
treec6609e3b6f1dcbac565dee44039dfc1f0aec4752 /Lib/site.py
parent798ed8f0764379d285779a4966a1fee6db61e293 (diff)
downloadcpython-d112bc7958151fa17c4ccb27413c43e45b8476fb.zip
cpython-d112bc7958151fa17c4ccb27413c43e45b8476fb.tar.gz
cpython-d112bc7958151fa17c4ccb27413c43e45b8476fb.tar.bz2
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
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py
index e2ad3b92c..113f221 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -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')