mirror of https://github.com/python/cpython
gh-88279: Deprecate PySys_SetArgvEx() (#92363)
Deprecate the following C functions: * PySys_SetArgv() * PySys_SetArgvEx() * PySys_SetPath()
This commit is contained in:
parent
5f29268283
commit
299692afd8
|
@ -616,6 +616,11 @@ Process-wide parameters
|
||||||
single: Py_FatalError()
|
single: Py_FatalError()
|
||||||
single: argv (in module sys)
|
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
|
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
|
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
|
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;
|
.. XXX impl. doesn't seem consistent in allowing ``0``/``NULL`` for the params;
|
||||||
check w/ Guido.
|
check w/ Guido.
|
||||||
|
|
||||||
|
.. deprecated:: 3.11
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: void PySys_SetArgv(int argc, wchar_t **argv)
|
.. 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
|
This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set
|
||||||
to ``1`` unless the :program:`python` interpreter was started with the
|
to ``1`` unless the :program:`python` interpreter was started with the
|
||||||
:option:`-I`.
|
:option:`-I`.
|
||||||
|
@ -674,6 +685,8 @@ Process-wide parameters
|
||||||
|
|
||||||
.. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`.
|
.. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`.
|
||||||
|
|
||||||
|
.. deprecated:: 3.11
|
||||||
|
|
||||||
|
|
||||||
.. c:function:: void Py_SetPythonHome(const wchar_t *home)
|
.. c:function:: void Py_SetPythonHome(const wchar_t *home)
|
||||||
|
|
||||||
|
|
|
@ -709,12 +709,10 @@ the table of loaded modules, and creates the fundamental modules
|
||||||
:mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also
|
:mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also
|
||||||
initializes the module search path (``sys.path``).
|
initializes the module search path (``sys.path``).
|
||||||
|
|
||||||
.. index:: single: PySys_SetArgvEx()
|
|
||||||
|
|
||||||
:c:func:`Py_Initialize` does not set the "script argument list" (``sys.argv``).
|
: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
|
If this variable is needed by Python code that will be executed later, setting
|
||||||
be set explicitly with a call to ``PySys_SetArgvEx(argc, argv, updatepath)``
|
:c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` must be set: see
|
||||||
after the call to :c:func:`Py_Initialize`.
|
:ref:`Python Initialization Configuration <init-config>`.
|
||||||
|
|
||||||
On most systems (in particular, on Unix and Windows, although the details are
|
On most systems (in particular, on Unix and Windows, although the details are
|
||||||
slightly different), :c:func:`Py_Initialize` calculates the module search path
|
slightly different), :c:func:`Py_Initialize` calculates the module search path
|
||||||
|
|
|
@ -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)
|
.. 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
|
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
|
be a list of paths separated with the platform's search path delimiter
|
||||||
(``:`` on Unix, ``;`` on Windows).
|
(``:`` on Unix, ``;`` on Windows).
|
||||||
|
|
||||||
|
.. deprecated:: 3.11
|
||||||
|
|
||||||
.. c:function:: void PySys_WriteStdout(const char *format, ...)
|
.. c:function:: void PySys_WriteStdout(const char *format, ...)
|
||||||
|
|
||||||
Write the output string described by *format* to :data:`sys.stdout`. No
|
Write the output string described by *format* to :data:`sys.stdout`. No
|
||||||
|
|
|
@ -1742,6 +1742,9 @@ Deprecated
|
||||||
* :c:func:`PySys_AddWarnOption`
|
* :c:func:`PySys_AddWarnOption`
|
||||||
* :c:func:`PySys_AddXOption`
|
* :c:func:`PySys_AddXOption`
|
||||||
* :c:func:`PySys_HasWarnOptions`
|
* :c:func:`PySys_HasWarnOptions`
|
||||||
|
* :c:func:`PySys_SetArgvEx`
|
||||||
|
* :c:func:`PySys_SetArgv`
|
||||||
|
* :c:func:`PySys_SetPath`
|
||||||
* :c:func:`Py_SetPath`
|
* :c:func:`Py_SetPath`
|
||||||
* :c:func:`Py_SetProgramName`
|
* :c:func:`Py_SetProgramName`
|
||||||
* :c:func:`Py_SetPythonHome`
|
* :c:func:`Py_SetPythonHome`
|
||||||
|
@ -1750,7 +1753,7 @@ Deprecated
|
||||||
|
|
||||||
Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization Configuration
|
Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization Configuration
|
||||||
<init-config>` instead (:pep:`587`).
|
<init-config>` instead (:pep:`587`).
|
||||||
(Contributed by Victor Stinner in :issue:`44113`.)
|
(Contributed by Victor Stinner in :gh:`88279`.)
|
||||||
|
|
||||||
* Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:func:`PyObject_Hash` instead.
|
* Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:func:`PyObject_Hash` instead.
|
||||||
(Contributed by Inada Naoki in :issue:`46864`.)
|
(Contributed by Inada Naoki in :issue:`46864`.)
|
||||||
|
|
|
@ -10,9 +10,9 @@ extern "C" {
|
||||||
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *);
|
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *);
|
||||||
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *);
|
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *);
|
||||||
|
|
||||||
PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
|
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
|
||||||
PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
|
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
|
||||||
PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
|
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
|
||||||
|
|
||||||
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
||||||
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Deprecate the C functions: :c:func:`PySys_SetArgv`,
|
||||||
|
:c:func:`PySys_SetArgvEx`, :c:func:`PySys_SetPath`. Patch by Victor Stinner.
|
Loading…
Reference in New Issue