[Python-bugs-list] [ python-Bugs-488477 ] Reference counting bugs

noreply@sourceforge.net noreply@sourceforge.net
Mon, 03 Dec 2001 11:45:18 -0800


Bugs item #488477, was opened at 2001-12-03 09:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=488477&group_id=5470

Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Armin Rigo (arigo)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Reference counting bugs

Initial Comment:
Various refcounting bugs:

1. Objects/abstract.c: PyObject_Call():
missing Py_DECREF() on the object returned by 
PyObject_Repr(func). Moreover this function's return 
value is not tested for NULL, which might crash the 
interpreter.

2. Objects/funcobjects.c: function_call():
the Py_DECREF(arg) after PyErr_NoMemory() should be 
removed

3. Python/ceval.c: unpack_iterable():
in the path through the error "too many values to 
unpack", a Py_DECREF(w) is missing

4. Python/ceval.c: apply_slice():
the slice object returned by PySlice_New() is never 
Py_DECREF'ed.

5. Python/ceval.c: assign_slice():
the slice object returned by PySlice_New() is never 
Py_DECREF'ed.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-03 11:45

Message:
Logged In: YES 
user_id=6380

Thanks, Armin.  I'd be interested in finding out which tool
you used to find these!

- Item #1 is no longer current; this was solved by not
calling PyObject_Repr(func) at all (which has all sorts of
other bad potential implications, so it's best not to call
it for the purpose of creating friendly error messages).

- Item #2: Good catch.  Must've been a remnant of a
transformation long ago, when this code was moved from an
in-line position in ceval.c to a separate function.  Fixed
in cvs, funcobject.c:2.48.

- Item #3: Good job again.   Fixed in ceval.c:2.292.  I've
added a test case too, test_iter.py:1.23.

- Items #4 and #5: Right.  Fixed in ceval.c:2.293.

This concludes this bug report.  Closing as Fixed.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-03 11:10

Message:
Logged In: YES 
user_id=6380

I'll have a look at these.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-12-03 09:21

Message:
Logged In: YES 
user_id=31435

Boosted priority.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=488477&group_id=5470