[ python-Bugs-1229429 ] missing Py_DECREF in PyObject_CallMethod

SourceForge.net noreply at sourceforge.net
Tue Jul 12 12:31:42 CEST 2005


Bugs item #1229429, was opened at 2005-06-28 21:18
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1229429&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: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Gary (gdray-1)
Assigned to: Michael Hudson (mwh)
Summary: missing Py_DECREF in PyObject_CallMethod

Initial Comment:
Once PyObject *func has been successfully returned by 
PyObject_GetAttrString(), the ref count is not 
decremented by any of the error exit cases from 
PyObject_CallMethod(). After the check that func is not 
NULL, there are four error case exits that do not 
decrement the ref count on func.

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-07-12 05:31

Message:
Logged In: YES 
user_id=80475

It's not an official, documented protocol.  It is an
implementation detail (choosen as a way to decouple
individual types from the general purpose reversed() code).
 It is tested via the types than implement __reversed__
(such as collections.deque).  BTW, all the general testing
for reversed is cleverly hidden in test_enumerate.

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

Comment By: Michael Hudson (mwh)
Date: 2005-07-12 05:23

Message:
Logged In: YES 
user_id=6656

Heh, it's a fair cop.

Fixed in:

Objects/abstract.c revision 2.137
Lib/test/test_enumerate.py revision 1.15
Misc/NEWS revision 1.1313

Raymond, while I have your attention, is the __reversed__ protocol tested 
anywhere?

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2005-07-11 22:08

Message:
Logged In: YES 
user_id=80475

Assigning to the god of leak fixes.

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

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


More information about the Python-bugs-list mailing list