GH-59313: Do not allow incomplete tuples, or tuples with NULLs.#117747
GH-59313: Do not allow incomplete tuples, or tuples with NULLs.#117747markshannon wants to merge 19 commits into
Conversation
vstinner
left a comment
There was a problem hiding this comment.
You should also update _PyTuple_Resize():
/* Zero out items added by growing */
if (newsize > oldsize)
memset(&sv->ob_item[oldsize], 0,
sizeof(*sv->ob_item) * (newsize - oldsize));
Sorry, something went wrong.
|
Overall, the change looks good to me, but I made a second review with more suggestions. |
Sorry, something went wrong.
erlend-aasland
left a comment
There was a problem hiding this comment.
Some nits
Sorry, something went wrong.
|
This change seems to break weakrefs. Closing until I have time to investigate and fix it. |
Sorry, something went wrong.
|
It is possible that changing from |
Sorry, something went wrong.
Prevents
gc.get_referrersfrom returning invalid tuples, and should make the cycle GC a bit more robust.Not using
NULLallows some efficiency improvements, like changingXDECREFtoDECREF.I've also streamlined
tuple_alloc, since I was fiddling with tuple creation and destruction anyway.PySequence_Tupletakes 0.02% of the runtime of the benchmark suite, so any change to its performance will be undetectable.