Author ysj.ray
Recipients Retro, brian.curtin, eli.bendersky, eric.araujo, eric.smith, georg.brandl, giampaolo.rodola, rhettinger, terry.reedy, xuanji, ysj.ray
Date 2010-12-10.10:12:39
SpamBayes Score 2.01261e-06
Marked as misclassified No
Message-id <1291975961.57.0.14569745626.issue10516@psf.upfronthosting.co.za>
In-reply-to
Content
> That's good if it's so... can you explain why list_clear doesn't 
> guarantee that the list is empty? Why would XDECREF populate the list? 
> I don't quite understand it.


Does this mean that durning the Py_DECREF progress the list may be populated again? It's not a problem. Here is the simplest example(with applying eli's patch):


class A(object):
    def __init__(self, li):
        self._li = li
    def __del__(self):
        self._li.append(self)

li = []
li.append(A(li))
li.clear()
print(li)
History
Date User Action Args
2010-12-10 10:12:41ysj.raysetrecipients: + ysj.ray, georg.brandl, rhettinger, terry.reedy, eric.smith, giampaolo.rodola, eric.araujo, Retro, eli.bendersky, brian.curtin, xuanji
2010-12-10 10:12:41ysj.raysetmessageid: <1291975961.57.0.14569745626.issue10516@psf.upfronthosting.co.za>
2010-12-10 10:12:39ysj.raylinkissue10516 messages
2010-12-10 10:12:39ysj.raycreate