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 sbt
Recipients alexandre.vassalotti, belopolsky, benjamin.peterson, bpb, brett.cannon, ehuss, facundobatista, fmitha, georg.brandl, gvanrossum, jafo, jaraco, jarpa, kylev, loewis, lukasz.langa, nnorwitz, pitrou, sbt, taleinat, tseaver, vstinner, zbysz, zseil
Date 2012-07-27.19:00:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343415641.48.0.990413575644.issue1692335@psf.upfronthosting.co.za>
In-reply-to
Content
> Or you could simply Py_INCREF(args) before the Py_XDECREF...

But won't self->args point to a broken object while any callbacks triggered by Py_XDECREF() are run?

An alternative would be

    tmp = self->args;
    self->args = args;
    Py_INCREF(self->args);
    Py_XDECREF(tmp);

As far as I can see the idiom Py_?DECREF(self->...) is rarely safe outside of a deallocator unless you are sure the pointed to object has a "safe" type (or you are sure the refcount cannot fall to zero).
History
Date User Action Args
2012-07-27 19:00:41sbtsetrecipients: + sbt, gvanrossum, loewis, nnorwitz, brett.cannon, georg.brandl, facundobatista, jafo, ehuss, tseaver, jaraco, belopolsky, zseil, fmitha, pitrou, vstinner, taleinat, alexandre.vassalotti, benjamin.peterson, jarpa, bpb, zbysz, kylev, lukasz.langa
2012-07-27 19:00:41sbtsetmessageid: <1343415641.48.0.990413575644.issue1692335@psf.upfronthosting.co.za>
2012-07-27 19:00:40sbtlinkissue1692335 messages
2012-07-27 19:00:40sbtcreate