[Python-checkins] r51306 - in python/trunk: Lib/idlelib/CREDITS.txt Lib/idlelib/NEWS.txt Lib/idlelib/PyShell.py Lib/site.py Misc/NEWS

kurt.kaiser python-checkins at python.org
Wed Aug 16 07:01:44 CEST 2006


Author: kurt.kaiser
Date: Wed Aug 16 07:01:42 2006
New Revision: 51306

Modified:
   python/trunk/Lib/idlelib/CREDITS.txt
   python/trunk/Lib/idlelib/NEWS.txt
   python/trunk/Lib/idlelib/PyShell.py
   python/trunk/Lib/site.py
   python/trunk/Misc/NEWS
Log:
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


Modified: python/trunk/Lib/idlelib/CREDITS.txt
==============================================================================
--- python/trunk/Lib/idlelib/CREDITS.txt	(original)
+++ python/trunk/Lib/idlelib/CREDITS.txt	Wed Aug 16 07:01:42 2006
@@ -24,8 +24,8 @@
 integration, debugger integration and persistent breakpoints).
 
 Scott David Daniels, Tal Einat, Hernan Foffani, Christos Georgiou,
-Martin v. Löwis, Jason Orendorff, Josh Robb, Nigel Rowe, Bruce Sherwood,
-and Jeff Shute have submitted useful patches.  Thanks, guys!
+Jim Jewett, Martin v. Löwis, Jason Orendorff, Josh Robb, Nigel Rowe,
+Bruce Sherwood, and Jeff Shute have submitted useful patches.  Thanks, guys!
 
 For additional details refer to NEWS.txt and Changelog.
 

Modified: python/trunk/Lib/idlelib/NEWS.txt
==============================================================================
--- python/trunk/Lib/idlelib/NEWS.txt	(original)
+++ python/trunk/Lib/idlelib/NEWS.txt	Wed Aug 16 07:01:42 2006
@@ -3,7 +3,11 @@
 
 *Release date: 17-AUG-2006*
 
-- The 'with' statement is now a Code Context block opener
+- IDLE honors new quit() and exit() commands from site.py Quitter() object.
+  Patch 1540892, Jim Jewett
+
+- The 'with' statement is now a Code Context block opener.
+  Patch 1540851, Jim Jewett
 
 - Retrieval of previous shell command was not always preserving indentation
   (since 1.2a1) Patch 1528468 Tal Einat.

Modified: python/trunk/Lib/idlelib/PyShell.py
==============================================================================
--- python/trunk/Lib/idlelib/PyShell.py	(original)
+++ python/trunk/Lib/idlelib/PyShell.py	Wed Aug 16 07:01:42 2006
@@ -478,9 +478,6 @@
         import sys as _sys
         _sys.path = %r
         del _sys
-        _msg = 'Use File/Exit or your end-of-file key to quit IDLE'
-        __builtins__.quit = __builtins__.exit = _msg
-        del _msg
         \n""" % (sys.path,))
 
     active_seq = None
@@ -514,7 +511,10 @@
                 print >>sys.__stderr__, errmsg, what
                 print >>console, errmsg, what
             # we received a response to the currently active seq number:
-            self.tkconsole.endexecuting()
+            try:
+                self.tkconsole.endexecuting()
+            except AttributeError:  # shell may have closed
+                pass
         # Reschedule myself
         if not self.tkconsole.closing:
             self.tkconsole.text.after(self.tkconsole.pollinterval,
@@ -730,7 +730,10 @@
                     self.tkconsole.endexecuting()
         finally:
             if not use_subprocess:
-                self.tkconsole.endexecuting()
+                try:
+                    self.tkconsole.endexecuting()
+                except AttributeError:  # shell may have closed
+                    pass
 
     def write(self, s):
         "Override base class method"
@@ -804,9 +807,6 @@
         #
         OutputWindow.__init__(self, flist, None, None)
         #
-        import __builtin__
-        __builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D."
-        #
 ##        self.config(usetabs=1, indentwidth=8, context_use_ps1=1)
         self.usetabs = True
         # indentwidth must be 8 when using tabs.  See note in EditorWindow:

Modified: python/trunk/Lib/site.py
==============================================================================
--- python/trunk/Lib/site.py	(original)
+++ python/trunk/Lib/site.py	Wed Aug 16 07:01:42 2006
@@ -242,6 +242,12 @@
         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')

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Aug 16 07:01:42 2006
@@ -64,6 +64,9 @@
 Library
 -------
 
+- Patch #1540892: site.py Quitter() class attempts to close sys.stdin
+  before raising SystemExit, allowing IDLE to honor quit() and exit().
+
 - Bug #1224621: make tabnanny recognize IndentationErrors raised by tokenize.
 
 - Patch #1536071: trace.py should now find the full module name of a


More information about the Python-checkins mailing list