From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 1 Oct 2025 05:56:39 +0000 (+0200) Subject: [3.13] Document that `PyInterpreterState_GetDict` returns a borrowed reference (GH... X-Git-Tag: v3.13.8~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0114bbe43ac015b9b78af430653663e345ee8478;p=thirdparty%2FPython%2Fcpython.git [3.13] Document that `PyInterpreterState_GetDict` returns a borrowed reference (GH-139451) (#139464) Document that `PyInterpreterState_GetDict` returns a borrowed reference (GH-139451) (cherry picked from commit 80cdf3ef74f6622899c1c82af1e08492e4ab7a00) Co-authored-by: Petr Viktorin --- diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 211b902ad1e4..cc0f7c3a7de3 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1477,6 +1477,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 53e2ea717ed7..67f551cf6de4 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -1148,6 +1148,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::