summaryrefslogtreecommitdiff
path: root/Lib/site.py
diff options
context:
space:
mode:
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 e2ad3b92c5..113f2215e5 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')