Pablo Galindo Salgado <pablog...@gmail.com> added the comment:

> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15108>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to