Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1449)

Issue 110078: Add a stream parameter to gc.set_debug

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 7 months ago by nicdumz
Modified:
14 years, 7 months ago
Reviewers:
amaury
Base URL:
http://svn.python.org/view/*checkout*/python/trunk/
Visibility:
Public.

Description

http://bugs.python.org/issue5851

Patch Set 1 #

Total comments: 4

Patch Set 2 : do not rely on FILE* for py3k; doc fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -17 lines) Patch
M Doc/library/gc.rst View 1 1 chunk +7 lines, -4 lines 0 comments Download
M Lib/test/test_gc.py View 1 2 chunks +33 lines, -0 lines 0 comments Download
M Misc/ACKS View 1 chunk +1 line, -0 lines 0 comments Download
M Misc/NEWS View 1 chunk +3 lines, -0 lines 0 comments Download
M Modules/gcmodule.c View 1 8 chunks +65 lines, -13 lines 0 comments Download

Messages

Total messages: 2
amaury
The patch is complete, tests and doc... Thanks! It won't apply to py3k, though: python ...
14 years, 7 months ago (2009-08-25 07:07:20 UTC) #1
nicdumz
14 years, 7 months ago (2009-08-25 10:26:30 UTC) #2
Here is an updated patch.

Who can we nosy to get feedback on the appropriateness of calling a Python
function inside debug_print?

Thanks :)

http://codereview.appspot.com/110078/diff/1/4
File Doc/library/gc.rst (right):

http://codereview.appspot.com/110078/diff/1/4#newcode60
Line 60: descriptor to which debugging information will be written. See below
for a
On 2009/08/25 07:07:20, amauryfa wrote:
> better say: "a file object"

Done.

http://codereview.appspot.com/110078/diff/1/6
File Modules/gcmodule.c (right):

http://codereview.appspot.com/110078/diff/1/6#newcode704
Line 704: FILE* file = PyFile_AsFile((PyObject*) debug_output);
On 2009/08/25 07:07:20, amauryfa wrote:
> PyFile_AsFile does not exist with python 3. (py3 files have no FILE*) Is it
> possible to use the 'write' method directly? Or is it forbidden from inside
the
> garbage collector?

Done. I am accessing the write method directly in set_debug to minimize the
Python code running in debug_print.
I am not sure If it's safe to call a function from inside the gc: I'm not
qualified enough to answer that question :)

Since we use stream.write now, we can potentially run arbitrary code there. If
it's not safe, is there is any mechanism in py3 that would allow us to use a
vfprintf-like on a file object? To avoid running any Python code at all?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b