From d6e6cd1e5ba77be0424878d8eb8f5c6f6fbdeebe Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 30 Sep 2025 17:22:47 +0200 Subject: [PATCH] Document that PyInterpreterState_GetDict returns a borrowed reference --- Doc/c-api/init.rst | 3 +++ Doc/data/refcounts.dat | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 4b8884f48e8b28..ccf85e627f9b5f 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1382,6 +1382,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`. This is not a replacement for :c:func:`PyModule_GetState()`, which extensions should use to store interpreter-specific state information. + The returned dictionary is borrowed from the interpreter and is valid until + interpreter shutdown. + .. versionadded:: 3.8 diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat index 44ee2586301259..48f4f4919e8966 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -1141,6 +1141,9 @@ PyInterpreterState_Clear:PyInterpreterState*:interp:: PyInterpreterState_Delete:void::: PyInterpreterState_Delete:PyInterpreterState*:interp:: +PyInterpreterState_GetDict:PyObject*::0: +PyInterpreterState_GetDict:PyInterpreterState*:interp:: + PyInterpreterState_GetID:int64_t::: PyInterpreterState_GetID:PyInterpreterState*:interp::