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 benjamin.peterson, georg.brandl, larry, serhiy.storchaka, skrah, vstinner
Date 2014-01-29.18:14:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Proposed patches replaced idiomatic code

    ptr = new_value;

to "Py_REPLACE(ptr, new_value);" which is expanded to

        PyObject *__tmp__ = ptr;
        ptr = new_value;

(and same for Py_XDECREF -> Py_XREPLACE).

Victor proposed large patch for issue16447, but this issue was closed after fixing particular bug. Here are updated patches, which Py_REPLACE/Py_XREPLACE macros for cleaner code. They are also generated automatically by the Coccinelle tool (

spatch --in-place --sp-file py_replace.spatch --dir .

Patch for every version contains about 50 replaces in about 21-24 files.
Date User Action Args
2014-01-29 18:14:18serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, vstinner, larry, benjamin.peterson, skrah
2014-01-29 18:14:18serhiy.storchakasetmessageid: <>
2014-01-29 18:14:18serhiy.storchakalinkissue20440 messages
2014-01-29 18:14:18serhiy.storchakacreate