From: Richard Hansen Date: Sat, 23 Nov 2024 19:47:08 +0000 (-0500) Subject: Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (#126667) X-Git-Tag: v3.14.0a3~228 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3038e976b25a58f512d8c7083a752c89436eb0d;p=thirdparty%2FPython%2Fcpython.git Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (#126667) --- diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 24d876d1f355..970084ce91ab 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