mirror of https://github.com/python/cpython
Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (#126667)
This commit is contained in:
parent
cc813e10ff
commit
e3038e976b
|
@ -1738,7 +1738,11 @@ function. You can create and destroy them using the following functions:
|
||||||
.check_multi_interp_extensions = 1,
|
.check_multi_interp_extensions = 1,
|
||||||
.gil = PyInterpreterConfig_OWN_GIL,
|
.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.
|
Note that the config is used only briefly and does not get modified.
|
||||||
During initialization the config's values are converted into various
|
During initialization the config's values are converted into various
|
||||||
|
|
Loading…
Reference in New Issue