Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Doc/c-api/dict.rst
Co-authored-by: Petr Viktorin <encukou@gmail.com>
  • Loading branch information
colesbury and encukou authored Nov 16, 2023
commit 74b1d0bd58025afb8b8d69e6314e810e4d0ef651
12 changes: 9 additions & 3 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,15 @@ Dictionary Objects
*default_value*, if the key was not present, or the existing value, if *key*
was already present in the dictionary.
Returns ``1`` if the key was present and *default_value* was not inserted,
``0`` if the key was not present and *default_value* was inserted, or
``-1`` on failure.

or ``0`` if the key was not present and *default_value* was inserted.
On failure, returns ``-1``, sets an exception, and sets ``*result``
to ``NULL``.

For clarity: if you have a strong reference to *default_value* before
calling this function, then after it returns, you hold a strong reference
to both *default_value* and *\*result* (if it's not ``NULL``).
These may refer to the same object: in that case you hold two separate
references to it.
.. versionadded:: 3.13


Expand Down