classification
Title: Add a stream parameter to gc.set_debug
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, nicdumz
Priority: normal Keywords:

Created on 2009-04-27 06:24 by nicdumz, last changed 2009-08-24 23:10 by nicdumz.

Messages (3)
msg86647 - (view) Author: Nicolas Dumazet (nicdumz) Date: 2009-04-27 06:24
Hello!

gc.set_debug is provided to help debugging a leaking program. That tool
can be very useful indeed. 

Debugging information, however, is written to sys.stderr, and there are
cases where this behavior can be a problem: chances are that stderr can
be already used to output other information.

Currently, to debug a verbose program writing to stderr, one has to
either first reduce/suppress the stderr output noise from its program
before activating set_debug, OR has to redirect the whole mixed stderr
output, and filter it afterwards. 

I'd like very much the possibility to configure myself where the gc
debugger will write its output.

My suggestion would be to have set_debug converted from set_debug(flags)
to set_debug(flags, stream=sys.stderr), stream being any valid file
object, but any solution allowing me to customize the output target of
the gc debugger would be welcome.

Thanks!
msg88418 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-05-27 14:00
Would you like to work on a patch?
msg91947 - (view) Author: Nicolas Dumazet (nicdumz) Date: 2009-08-24 23:10
Sure, I'd be happy to contribute a patch.

I uploaded a patch on Rietveld, at http://codereview.appspot.com/110078

Let me know how it looks.
History
Date User Action Args
2009-08-24 23:10:52nicdumzsetmessages: + msg91947
2009-05-27 14:00:39amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg88418
components: + Interpreter Core, - Extension Modules
2009-04-27 06:24:01nicdumzcreate