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.

Author serhiy.storchaka
Recipients python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2016-02-11.12:25:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455193519.25.0.132541521943.issue26200@psf.upfronthosting.co.za>
In-reply-to
Content
Py_SETREF() is used not only for fixing possible bugs. It can make the correct code shorter and cleaner. For example Stephan appreciated this in df78978dacab. In most case the difference between Py_DECREF and Py_XDECREF looks negligible.

Most of the SETREFs in the next() functions in the itertools module replace Py_CLEAR and therefore don't add additional overhead (but may fix possible bugs). The only Py_DECREF were replaced in tee_next() and accumulate_next(). But they are used not in tight loop. Py_SETREF in tee_next() is executed only for every 57th call. It unlikely causes any measurable degradation. Py_SETREF in accumulate_next() is used together with calling PyIter_Next and PyNumber_Add() or PyObject_CallFunctionObjArgs() which takes much more time.

In any case it would be nice to see any measurements that show a degradation.
History
Date User Action Args
2016-02-11 12:25:19serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, vstinner, python-dev
2016-02-11 12:25:19serhiy.storchakasetmessageid: <1455193519.25.0.132541521943.issue26200@psf.upfronthosting.co.za>
2016-02-11 12:25:19serhiy.storchakalinkissue26200 messages
2016-02-11 12:25:18serhiy.storchakacreate