Skip to content

Commit

Permalink
Doc: C API: Fix Py_NewInterpreterFromConfig example code (pythonGH-…
Browse files Browse the repository at this point in the history
…126667)

(cherry picked from commit e3038e9)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
  • Loading branch information
rhansen authored and miss-islington committed Nov 23, 2024
1 parent f1e7424 commit 6aa1ef3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,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
Expand Down

0 comments on commit 6aa1ef3

Please sign in to comment.