diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-06 03:24:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 03:24:29 (GMT) |
commit | 299692afd8b8520383e6badeb907b285fc7c0909 (patch) | |
tree | 825d0469420265842ae5fa6ca3b61a766d0671d3 /Doc/c-api | |
parent | 5f29268283aba12d4f2c83cab4966286e0ac5128 (diff) | |
download | cpython-299692afd8b8520383e6badeb907b285fc7c0909.zip cpython-299692afd8b8520383e6badeb907b285fc7c0909.tar.gz cpython-299692afd8b8520383e6badeb907b285fc7c0909.tar.bz2 |
gh-88279: Deprecate PySys_SetArgvEx() (#92363)
Deprecate the following C functions:
* PySys_SetArgv()
* PySys_SetArgvEx()
* PySys_SetPath()
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/init.rst | 13 | ||||
-rw-r--r-- | Doc/c-api/intro.rst | 8 | ||||
-rw-r--r-- | Doc/c-api/sys.rst | 7 |
3 files changed, 23 insertions, 5 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index c17379c..d495495 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -616,6 +616,11 @@ Process-wide parameters single: Py_FatalError() single: argv (in module sys) + This API is kept for backward compatibility: setting + :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` and + :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python + Initialization Configuration <init-config>`. + Set :data:`sys.argv` based on *argc* and *argv*. These parameters are similar to those passed to the program's :c:func:`main` function with the difference that the first entry should refer to the script file to be @@ -659,9 +664,15 @@ Process-wide parameters .. XXX impl. doesn't seem consistent in allowing ``0``/``NULL`` for the params; check w/ Guido. + .. deprecated:: 3.11 + .. c:function:: void PySys_SetArgv(int argc, wchar_t **argv) + This API is kept for backward compatibility: setting + :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should be used + instead, see :ref:`Python Initialization Configuration <init-config>`. + This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to ``1`` unless the :program:`python` interpreter was started with the :option:`-I`. @@ -674,6 +685,8 @@ Process-wide parameters .. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`. + .. deprecated:: 3.11 + .. c:function:: void Py_SetPythonHome(const wchar_t *home) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index 3e7890c..9efac0b 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -709,12 +709,10 @@ the table of loaded modules, and creates the fundamental modules :mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also initializes the module search path (``sys.path``). -.. index:: single: PySys_SetArgvEx() - :c:func:`Py_Initialize` does not set the "script argument list" (``sys.argv``). -If this variable is needed by Python code that will be executed later, it must -be set explicitly with a call to ``PySys_SetArgvEx(argc, argv, updatepath)`` -after the call to :c:func:`Py_Initialize`. +If this variable is needed by Python code that will be executed later, setting +:c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` must be set: see +:ref:`Python Initialization Configuration <init-config>`. On most systems (in particular, on Unix and Windows, although the details are slightly different), :c:func:`Py_Initialize` calculates the module search path diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst index 66216ee..5e8d993 100644 --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -264,10 +264,17 @@ accessible to C code. They all work with the current interpreter thread's .. c:function:: void PySys_SetPath(const wchar_t *path) + 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 :data:`sys.path` to a list object of paths found in *path* which should be a list of paths separated with the platform's search path delimiter (``:`` on Unix, ``;`` on Windows). + .. deprecated:: 3.11 + .. c:function:: void PySys_WriteStdout(const char *format, ...) Write the output string described by *format* to :data:`sys.stdout`. No |