[Python-checkins] r59984 - in python/trunk: Lib/pdb.py Misc/NEWS

guido.van.rossum python-checkins at python.org
Tue Jan 15 18:59:29 CET 2008


Author: guido.van.rossum
Date: Tue Jan 15 18:59:29 2008
New Revision: 59984

Modified:
   python/trunk/Lib/pdb.py
   python/trunk/Misc/NEWS
Log:
Issue #1786 (by myself): pdb should use its own stdin/stdout around an
exec call and when creating a recursive instance.


Modified: python/trunk/Lib/pdb.py
==============================================================================
--- python/trunk/Lib/pdb.py	(original)
+++ python/trunk/Lib/pdb.py	Tue Jan 15 18:59:29 2008
@@ -199,7 +199,13 @@
         globals = self.curframe.f_globals
         try:
             code = compile(line + '\n', '<stdin>', 'single')
-            exec code in globals, locals
+            try:
+                sys.stdin = self.stdin
+                sys.stdout = self.stdout
+                exec code in globals, locals
+            finally:
+                sys.stdout = save_stdout
+                sys.stdin = save_stdin
         except:
             t, v = sys.exc_info()[:2]
             if type(t) == type(''):
@@ -659,7 +665,7 @@
         sys.settrace(None)
         globals = self.curframe.f_globals
         locals = self.curframe.f_locals
-        p = Pdb()
+        p = Pdb(self.completekey, self.stdin, self.stdout)
         p.prompt = "(%s) " % self.prompt.strip()
         print >>self.stdout, "ENTERING RECURSIVE DEBUGGER"
         sys.call_tracing(p.run, (arg, globals, locals))

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Jan 15 18:59:29 2008
@@ -358,11 +358,15 @@
 
 - Bug #1664966: Fix crash in exec if Unicode filename can't be decoded.
 
-- Issue #1537: Changed GeneratorExit's base class from Exception to BaseException.
+- Issue #1537: Changed GeneratorExit's base class from Exception to
+  BaseException.
 
 Library
 -------
 
+- Issue #1786: pdb should use its own stdin/stdout around an exec call
+  and when creating a recursive instance.
+
 - Issue #1698398 Zipfile.printdir() crashed because the format string
   expected a tuple type of length six instead of time.struct_time object.
 


More information about the Python-checkins mailing list