summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2024-11-23 19:47:08 (GMT)
committerGitHub <noreply@github.com>2024-11-23 19:47:08 (GMT)
commite3038e976b25a58f512d8c7083a752c89436eb0d (patch)
tree047bf97484db1a5a484351a17bab5aedd01d1ca7 /Doc
parentcc813e10ff190af38b8429d0d49fb9249493d504 (diff)
downloadcpython-e3038e976b25a58f512d8c7083a752c89436eb0d.zip
cpython-e3038e976b25a58f512d8c7083a752c89436eb0d.tar.gz
cpython-e3038e976b25a58f512d8c7083a752c89436eb0d.tar.bz2
Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (#126667)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/init.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 24d876d..970084c 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -1738,7 +1738,11 @@ function. You can create and destroy them using the following functions:
.check_multi_interp_extensions = 1,
.gil = PyInterpreterConfig_OWN_GIL,
};
- PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);
+ PyThreadState *tstate = NULL;
+ PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
+ if (PyStatus_Exception(status)) {
+ Py_ExitStatusException(status);
+ }
Note that the config is used only briefly and does not get modified.
During initialization the config's values are converted into various