summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-13 17:15:33 (GMT)
committerGitHub <noreply@github.com>2020-03-13 17:15:33 (GMT)
commitbe79373a78c0d75fc715ab64253c9b757987a848 (patch)
tree9fba5caff3547b80fbfd2b468339458e7d5d0037 /Doc
parentff4584caca04cb3da0dbd5b1e9bf67e40adf5312 (diff)
downloadcpython-be79373a78c0d75fc715ab64253c9b757987a848.zip
cpython-be79373a78c0d75fc715ab64253c9b757987a848.tar.gz
cpython-be79373a78c0d75fc715ab64253c9b757987a848.tar.bz2
bpo-39947: Add PyInterpreterState_Get() function (GH-18979)
* Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and move it the limited C API. * Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for backward compatibility with Python 3.8.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/init.rst12
-rw-r--r--Doc/whatsnew/3.9.rst2
2 files changed, 14 insertions, 0 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 747278c..661ed59 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -1072,6 +1072,18 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
to :c:func:`PyThreadState_Clear`.
+.. c:function:: PyInterpreterState* PyInterpreterState_Get(void)
+
+ Get the current interpreter.
+
+ Issue a fatal error if there no current Python thread state or no current
+ interpreter. It cannot return NULL.
+
+ The caller must hold the GIL.
+
+ .. versionadded:: 3.9
+
+
.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
Return the interpreter's unique ID. If there was any error in doing
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 0b61fb8..4373e37 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -406,6 +406,8 @@ Optimizations
Build and C API Changes
=======================
+* New :c:func:`PyInterpreterState_Get` function.
+
* Add ``--with-platlibdir`` option to the ``configure`` script: name of the
platform-specific library directory, stored in the new :attr:`sys.platlibdir`
attribute. See :attr:`sys.platlibdir` attribute for more information.