Skip to content

Commit e3038e9

Browse files
authored
Doc: C API: Fix Py_NewInterpreterFromConfig example code (#126667)
1 parent cc813e1 commit e3038e9

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
@@ -1738,7 +1738,11 @@ function. You can create and destroy them using the following functions:
17381738
.check_multi_interp_extensions = 1,
17391739
.gil = PyInterpreterConfig_OWN_GIL,
17401740
};
1741-
PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);
1741+
PyThreadState *tstate = NULL;
1742+
PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
1743+
if (PyStatus_Exception(status)) {
1744+
Py_ExitStatusException(status);
1745+
}
17421746
17431747
Note that the config is used only briefly and does not get modified.
17441748
During initialization the config's values are converted into various

0 commit comments

Comments
 (0)