GH-117283: Add doc warning for PyTuple_SetItem refcount > 1 (#117916)

This commit is contained in:
Savannah Ostrowski 2024-05-27 05:20:28 -07:00 committed by GitHub
parent 3b26cd8ca0
commit 041a566f3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,6 +105,12 @@ Tuple Objects
is being replaced; any reference in the tuple at position *pos* will be
leaked.
.. warning::
This macro should *only* be used on tuples that are newly created.
Using this macro on a tuple that is already in use (or in other words, has
a refcount > 1) could lead to undefined behavior.
.. c:function:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)