diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 694b4669eea897..0ca772f32d17b2 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -245,14 +245,19 @@ Initializing and finalizing the interpreter the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes the module search path (``sys.path``). It does not set ``sys.argv``; use - :c:func:`PySys_SetArgvEx` for that. This is a no-op when called for a second time - (without calling :c:func:`Py_FinalizeEx` first). There is no return value; it is a + :c:func:`PySys_SetArgvEx` for that. There is no return value; it is a fatal error if the initialization fails. .. note:: On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which will also affect non-Python uses of the console using the C Runtime. + .. versionchanged:: 3.7 + + Calling :c:func:`Py_Initialize` or :c:func:`Py_InitializeEx` a second + time without an intervening call to :c:func:`Py_FinalizeEx` is deprecated + and is expected to become an error in a future release. + .. c:function:: void Py_InitializeEx(int initsigs) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 287a027a04e145..b2f2e099482c8c 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -2415,7 +2415,7 @@ In preparation for potential future changes to the public CPython runtime initialization API (see :pep:`432` for an initial, but somewhat outdated, draft), CPython's internal startup and configuration management logic has been significantly refactored. While -these updates are intended to be entirely transparent to both embedding +these updates are intended to be almost entirely transparent to both embedding applications and users of the regular CPython CLI, they're being mentioned here as the refactoring changes the internal order of various operations during interpreter startup, and hence may uncover previously latent defects, @@ -2430,7 +2430,11 @@ number of other issues). Some known details affected: * warnings filters added by an embedding application with :c:func:`PySys_AddWarnOption` should now more consistently take precedence - over the default filters set by the interpreter + over the default filters set by the interpreter. + +* calling :c:func:`Py_InitializeEx` a second time (directly or indirectly) + without an intervening call to :c:func:`Py_FinalizeEx` is now deprecated, + and is expected to become an error in a future release. Due to changes in the way the default warnings filters are configured, setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no longer