classification
Title: pdb should set stdin+stdout around exec call
Type: behavior
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum
Priority: low Keywords: easy, patch

Created on 2008-01-11 01:05 by gvanrossum, last changed 2008-01-15 18:00 by gvanrossum.

Files
File name Uploaded Description Edit Remove
pdb.diff gvanrossum, 2008-01-11 01:05
pdb.diff gvanrossum, 2008-01-15 01:43 new fix
Messages
msg59686 (view) Author: Guido van Rossum (gvanrossum) Date: 2008-01-11 01:05
When you type a command in pdb that happens to print something, the
output goes to sys.stdout, even if self.stdout references another file.
 This makes it hard to debug code running inside a web server where
sys.stdout/stdout are connected to a socket (or a WSGI wrapper file);
the output "disappears" and ends up messing up the response.

Attached is a fix that temporarily changes sys.stdin/stdout to the
debugger's input and output.  What do people think of this?
msg59951 (view) Author: Guido van Rossum (gvanrossum) Date: 2008-01-15 01:43
Here's an improved patch -- the recursive debugger invocation should
pass the I/O settings on.
msg59979 (view) Author: Guido van Rossum (gvanrossum) Date: 2008-01-15 18:00
Committed revision 59984 (2.6).
Decided not to backport this to 2.5.
History
Date User Action Args
2008-01-15 18:00:24gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg59979
versions: - Python 2.5
2008-01-15 01:43:22gvanrossumsetkeywords: + easy
assignee: gvanrossum
messages: + msg59951
files: + pdb.diff
2008-01-11 01:05:11gvanrossumsetkeywords: + patch
2008-01-11 01:05:05gvanrossumcreate