Skip to content

Commit 07ba540

Browse files
committed
Edit docs
1 parent b6508df commit 07ba540

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Doc/c-api/object.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,14 @@ Object Protocol
621621
conservative, and may return ``0`` in some cases even if *obj* is a unique
622622
temporary object.
623623
624-
If an object is a unique temporary, it is guaranteed that the reference
625-
count is ``1`` and it may be safe to modify the object in-place because
626-
it is not visible to any other code.
624+
If an object is a unique temporary, it is guaranteed that the current code
625+
has the only reference to the object. For arguments to C functions, this
626+
should be used instead of checking if the reference count is ``1``. Starting
627+
with Python 3.14, the interpreter internally avoids some reference count
628+
modifications when loading objects onto the operands stack by
629+
:term:`borrowing <borrowed reference>` references when possible, which means
630+
that a reference count of ``1`` by itself does not guarantee that a function
631+
argument uniquely referenced.
627632
628633
In the example below, ``my_func`` is called with a unique temporary object
629634
as its argument::

0 commit comments

Comments
 (0)