https://github.com/python/cpython/commit/041a566f3f987619cef7d6ae7915ba93e39d2d1e
commit: 041a566f3f987619cef7d6ae7915ba93e39d2d1e
branch: main
author: Savannah Ostrowski <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2024-05-27T17:50:28+05:30
summary:

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

files:
M Doc/c-api/tuple.rst

diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst
index 0d68a360f347f8..52668d16b74436 100644
--- a/Doc/c-api/tuple.rst
+++ b/Doc/c-api/tuple.rst
@@ -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)
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to