This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: missing Py_DECREF in PyObject_CallMethod
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mwh Nosy List: gdray-1, mwh, rhettinger
Priority: normal Keywords:

Created on 2005-06-29 02:18 by gdray-1, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg25672 - (view) Author: Gary (gdray-1) Date: 2005-06-29 02:18
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.
msg25673 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-07-12 03:08
Logged In: YES 
user_id=80475

Assigning to the god of leak fixes.
msg25674 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-07-12 10:23
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?
msg25675 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-07-12 10:31
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.
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42139
2005-06-29 02:18:03gdray-1create