From 741576dd115bd9a2457f7a1e854bb4d0b0f8ec43 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Wed, 31 Oct 2018 21:10:11 -0400 Subject: [PATCH] Update documentation for initialize_interpreter (#1584) Add a detailed link to Python 3 documentation. Add a caveat about the program terminating if initializing the interpreter fails. --- include/pybind11/embed.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/pybind11/embed.h b/include/pybind11/embed.h index 9abc61c34..72655885e 100644 --- a/include/pybind11/embed.h +++ b/include/pybind11/embed.h @@ -90,8 +90,14 @@ NAMESPACE_END(detail) Initialize the Python interpreter. No other pybind11 or CPython API functions can be called before this is done; with the exception of `PYBIND11_EMBEDDED_MODULE`. The optional parameter can be used to skip the registration of signal handlers (see the - Python documentation for details). Calling this function again after the interpreter + `Python documentation`_ for details). Calling this function again after the interpreter has already been initialized is a fatal error. + + If initializing the Python interpreter fails, then the program is terminated. (This + is controlled by the CPython runtime and is an exception to pybind11's normal behavior + of throwing exceptions on errors.) + + .. _Python documentation: https://docs.python.org/3/c-api/init.html#c.Py_InitializeEx \endrst */ inline void initialize_interpreter(bool init_signal_handlers = true) { if (Py_IsInitialized())