diff options
author | Victor Stinner <vstinner@python.org> | 2021-05-12 21:59:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 21:59:25 (GMT) |
commit | 6cd0446ef72c6676b292d7f54b1ddb8ae5e1fb8d (patch) | |
tree | 096a9091641c61c9c45ce91ce2daa0c7eff8c121 /Doc/c-api/init.rst | |
parent | 504ffdae4e0cb7775f3e584c3b1d20c262fdfd7e (diff) | |
download | cpython-6cd0446ef72c6676b292d7f54b1ddb8ae5e1fb8d.zip cpython-6cd0446ef72c6676b292d7f54b1ddb8ae5e1fb8d.tar.gz cpython-6cd0446ef72c6676b292d7f54b1ddb8ae5e1fb8d.tar.bz2 |
bpo-44113: Deprecate old functions to config Python init (GH-26060)
Deprecate the following functions to configure the Python
initialization:
* PySys_AddWarnOption()
* PySys_AddWarnOptionUnicode()
* PySys_AddXOption()
* PySys_HasWarnOptions()
* Py_SetPath()
* Py_SetProgramName()
* Py_SetPythonHome()
* Py_SetStandardStreamEncoding()
* _Py_SetProgramFullPath()
Use the new PyConfig API of the Python Initialization Configuration
instead (PEP 587).
Diffstat (limited to 'Doc/c-api/init.rst')
-rw-r--r-- | Doc/c-api/init.rst | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 0f75973..6056424 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -323,6 +323,11 @@ Process-wide parameters single: main() triple: stdin; stdout; sdterr + This API is kept for backward compatibility: setting + :c:member:`PyConfig.stdio_encoding` and :c:member:`PyConfig.stdio_errors` + should be used instead, see :ref:`Python Initialization Configuration + <init-config>`. + This function should be called before :c:func:`Py_Initialize`, if it is called at all. It specifies which encoding and error handling to use with standard IO, with the same meanings as in :func:`str.encode`. @@ -345,6 +350,8 @@ Process-wide parameters .. versionadded:: 3.4 + .. deprecated:: 3.11 + .. c:function:: void Py_SetProgramName(const wchar_t *name) @@ -353,6 +360,10 @@ Process-wide parameters single: main() single: Py_GetPath() + This API is kept for backward compatibility: setting + :c:member:`PyConfig.program_name` should be used instead, see :ref:`Python + Initialization Configuration <init-config>`. + This function should be called before :c:func:`Py_Initialize` is called for the first time, if it is called at all. It tells the interpreter the value of the ``argv[0]`` argument to the :c:func:`main` function of the program @@ -367,6 +378,8 @@ Process-wide parameters Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:type:`wchar_*` string. + .. deprecated:: 3.11 + .. c:function:: wchar* Py_GetProgramName() @@ -495,6 +508,11 @@ Process-wide parameters single: path (in module sys) single: Py_GetPath() + This API is kept for backward compatibility: setting + :c:member:`PyConfig.module_search_paths` and + :c:member:`PyConfig.module_search_paths_set` should be used instead, see + :ref:`Python Initialization Configuration <init-config>`. + Set the default module search path. If this function is called before :c:func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a default search path but uses the one provided instead. This is useful if @@ -518,6 +536,8 @@ Process-wide parameters The program full path is now used for :data:`sys.executable`, instead of the program name. + .. deprecated:: 3.11 + .. c:function:: const char* Py_GetVersion() @@ -617,6 +637,9 @@ Process-wide parameters Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:type:`wchar_*` string. + See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` + members of the :ref:`Python Initialization Configuration <init-config>`. + .. note:: It is recommended that applications embedding the Python interpreter for purposes other than executing a single script pass ``0`` as *updatepath*, @@ -644,11 +667,18 @@ Process-wide parameters Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:type:`wchar_*` string. + See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` + members of the :ref:`Python Initialization Configuration <init-config>`. + .. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`. .. c:function:: void Py_SetPythonHome(const wchar_t *home) + This API is kept for backward compatibility: setting + :c:member:`PyConfig.home` should be used instead, see :ref:`Python + Initialization Configuration <init-config>`. + Set the default "home" directory, that is, the location of the standard Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument string. @@ -661,6 +691,8 @@ Process-wide parameters Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:type:`wchar_*` string. + .. deprecated:: 3.11 + .. c:function:: w_char* Py_GetPythonHome() |