[ python-Bugs-1370197 ] memory leak - ast_error_finish
SourceForge.net
noreply at sourceforge.net
Fri Dec 2 20:14:42 CET 2005
Bugs item #1370197, was opened at 2005-11-30 11:41
Message generated for change (Comment added) made by jimjjewett
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1370197&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: AST
Status: Open
Resolution: None
Priority: 5
Submitted By: Jim Jewett (jimjjewett)
Assigned to: Nobody/Anonymous (nobody)
Summary: memory leak - ast_error_finish
Initial Comment:
http://svn.python.org/view/python/trunk/Python/ast.c?
rev=41486&view=markup
function ast_error_finish
It first gets the errstr, for a possible early out.
If there is an error string, it is increfed, but it is
not decrefed on the other early outs. (lineno==-1 and
failure to build a tmp.
"""
Py_INCREF(errstr);
lineno = PyInt_AsLong(PyTuple_GetItem(value, 1));
if (lineno == -1)
return;
Py_DECREF(value);
loc = PyErr_ProgramText(filename, lineno);
if (!loc) {
Py_INCREF(Py_None);
loc = Py_None;
}
tmp = Py_BuildValue("(ziOO)", filename, lineno,
Py_None, loc);
Py_DECREF(loc);
if (!tmp)
return;
value = Py_BuildValue("(OO)", errstr, tmp);
Py_DECREF(errstr);
"""
----------------------------------------------------------------------
>Comment By: Jim Jewett (jimjjewett)
Date: 2005-12-02 14:14
Message:
Logged In: YES
user_id=764593
No, though it took me a *long* time to see why, because the
&value pointer is reused.
As best I understand it, PyErr_Fetch may leave (the initial
value of) value with the only reference to errstr.
There is a Py_DECREF(value) after successfully retrieving a
line number, but before using errstr to build the (new value
of) value for PyErr_Restore.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2005-12-02 00:22
Message:
Logged In: YES
user_id=33168
ISTM that we don't need the INCREF or DECREF for errstr. Do
you agree?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1370197&group_id=5470
More information about the Python-bugs-list
mailing list