Skip to content

Commit b1a241e

Browse files
[3.13] Doc: C API: Fix Py_NewInterpreterFromConfig example code (GH-126667) (#127201)
Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (GH-126667) (cherry picked from commit e3038e9) Co-authored-by: Richard Hansen <[email protected]>
1 parent d87fb9c commit b1a241e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/c-api/init.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,11 @@ function. You can create and destroy them using the following functions:
16881688
.check_multi_interp_extensions = 1,
16891689
.gil = PyInterpreterConfig_OWN_GIL,
16901690
};
1691-
PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);
1691+
PyThreadState *tstate = NULL;
1692+
PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
1693+
if (PyStatus_Exception(status)) {
1694+
Py_ExitStatusException(status);
1695+
}
16921696
16931697
Note that the config is used only briefly and does not get modified.
16941698
During initialization the config's values are converted into various

0 commit comments

Comments
 (0)