Author pablogsal
Recipients amaury.forgeotdarc, arigo, ghaering, iritkatriel, jcea, lkraav, pablogsal, pitrou, pxd, vstinner
Date 2021-02-15.17:58:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613411886.98.0.0984646568274.issue15108@roundup.psfhosted.org>
In-reply-to
Content
> IMO the unsafe PyTuple_New() API should be avoided.

Is not that simple, there are other APIs that track the tuple as _PyTuple_Resize. This problem also is not unique to tuples, although is mainly prominent in them.

We have this warning in the docs:

>> Care must be taken when using objects returned by get_referrers() because some of them could still be under construction and hence in a temporarily invalid state. Avoid using get_referrers() for any purpose other than debugging.

That's because *by thesign* these APIs can potentially access half-initialized objects. 

I don't know if is worth to add a new API just for tuples, given that this problem happens with many other objects
History
Date User Action Args
2021-02-15 17:58:07pablogsalsetrecipients: + pablogsal, arigo, jcea, ghaering, amaury.forgeotdarc, pitrou, vstinner, lkraav, pxd, iritkatriel
2021-02-15 17:58:06pablogsalsetmessageid: <1613411886.98.0.0984646568274.issue15108@roundup.psfhosted.org>
2021-02-15 17:58:06pablogsallinkissue15108 messages
2021-02-15 17:58:06pablogsalcreate