Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (#126667)

This commit is contained in:
Richard Hansen 2024-11-23 14:47:08 -05:00 committed by GitHub
parent cc813e10ff
commit e3038e976b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -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