[ python-Bugs-1370197 ] memory leak - ast_error_finish

SourceForge.net noreply at sourceforge.net
Fri Dec 2 06:22:20 CET 2005


Bugs item #1370197, was opened at 2005-11-30 08:41
Message generated for change (Comment added) made by nnorwitz
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: Neal Norwitz (nnorwitz)
Date: 2005-12-01 21: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