Skip to content

Commit 80cdf3e

Browse files
authored
Document that PyInterpreterState_GetDict returns a borrowed reference (python#139451)
1 parent 98a41af commit 80cdf3e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Doc/c-api/init.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13821382
This is not a replacement for :c:func:`PyModule_GetState()`, which
13831383
extensions should use to store interpreter-specific state information.
13841384
1385+
The returned dictionary is borrowed from the interpreter and is valid until
1386+
interpreter shutdown.
1387+
13851388
.. versionadded:: 3.8
13861389
13871390

Doc/data/refcounts.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ PyInterpreterState_Clear:PyInterpreterState*:interp::
11411141
PyInterpreterState_Delete:void:::
11421142
PyInterpreterState_Delete:PyInterpreterState*:interp::
11431143

1144+
PyInterpreterState_GetDict:PyObject*::0:
1145+
PyInterpreterState_GetDict:PyInterpreterState*:interp::
1146+
11441147
PyInterpreterState_GetID:int64_t:::
11451148
PyInterpreterState_GetID:PyInterpreterState*:interp::
11461149

0 commit comments

Comments
 (0)