[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I mainly agree on closing this issue as we already have a warning about this behaviour in gc.get_referrers and other friends. On the other hand I am still a bit afraid of a crash that could happen if the GC does a pass and one of these tuples is in

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: Unless there is a simple, reliable, cheap, and universal solution at hand, consider closing this. Given how long PyTuple_New() has exist, it doesn't seem to be much of a problem in the real world. Historically, we punted on "crashers" involving either

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-21 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-18 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Should we still fix sqlite3, or wait for an agreement on GH-24510? I suggest to let's all agree on how to fix this on the bigger scale first. -- ___ Python tracker

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-18 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Should we still fix sqlite3, or wait for an agreement on GH-24510? -- ___ Python tracker ___

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread STINNER Victor
STINNER Victor added the comment: > Any C extension class that implements a new_whatever() method that leaves the > class tracked and not ready. I'm not aware of such C extension but they likely exists. If we have such extensions in the stdlib, we can try to fix them. We cannot fix such GC

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- nosy: +erlendaasland ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > PyList_New() is also affected. Do you think about other types? Any C extension class that implements a new_whatever() method that leaves the class tracked and not ready. -- ___ Python tracker

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread STINNER Victor
STINNER Victor added the comment: > That's a lot slower unfortunately Ah sorry, I forgot PyTuple_Pack(3, item1, item2, item3) which should be very efficient. This function is also safe: only track the tuple when it is fully initialized. > This problem also is not unique to tuples, although

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > If the GIL is released before the tuple is fully populated and something > access to this tuple via the GC (ex: gc.get_objects()), accessing the tuple > can crash, especially in the Python land (for example, repr(the_tuple) is > likely to crash).

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > There are other safe alternatives like Py_BuildValue("(OOO)", item1, item2, > item3). That's a lot slower unfortunately -- ___ Python tracker

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado 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

[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-15 Thread STINNER Victor
STINNER Victor added the comment: The general issue here is a the PyTuple_New() is unsafe: it immediately tracks the newly created tuple in the GC, whereas the tuple is not initialized yet. If the GIL is released before the tuple is fully populated and something access to this tuple via the