Skip to content

Commit 029686f

Browse files
committed
remove PySys_SetArgv*
1 parent b582d75 commit 029686f

File tree

9 files changed

+6
-105
lines changed

9 files changed

+6
-105
lines changed

Doc/c-api/init.rst

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -658,85 +658,6 @@ Process-wide parameters
658658
``sys.version``.
659659
660660
661-
.. c:function:: void PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)
662-
663-
.. index::
664-
single: main()
665-
single: Py_FatalError()
666-
single: argv (in module sys)
667-
668-
This API is kept for backward compatibility: setting
669-
:c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` and
670-
:c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python
671-
Initialization Configuration <init-config>`.
672-
673-
Set :data:`sys.argv` based on *argc* and *argv*. These parameters are
674-
similar to those passed to the program's :c:func:`main` function with the
675-
difference that the first entry should refer to the script file to be
676-
executed rather than the executable hosting the Python interpreter. If there
677-
isn't a script that will be run, the first entry in *argv* can be an empty
678-
string. If this function fails to initialize :data:`sys.argv`, a fatal
679-
condition is signalled using :c:func:`Py_FatalError`.
680-
681-
If *updatepath* is zero, this is all the function does. If *updatepath*
682-
is non-zero, the function also modifies :data:`sys.path` according to the
683-
following algorithm:
684-
685-
- If the name of an existing script is passed in ``argv[0]``, the absolute
686-
path of the directory where the script is located is prepended to
687-
:data:`sys.path`.
688-
- Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point
689-
to an existing file name), an empty string is prepended to
690-
:data:`sys.path`, which is the same as prepending the current working
691-
directory (``"."``).
692-
693-
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
694-
:c:expr:`wchar_t*` string.
695-
696-
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
697-
members of the :ref:`Python Initialization Configuration <init-config>`.
698-
699-
.. note::
700-
It is recommended that applications embedding the Python interpreter
701-
for purposes other than executing a single script pass ``0`` as *updatepath*,
702-
and update :data:`sys.path` themselves if desired.
703-
See :cve:`2008-5983`.
704-
705-
On versions before 3.1.3, you can achieve the same effect by manually
706-
popping the first :data:`sys.path` element after having called
707-
:c:func:`PySys_SetArgv`, for example using::
708-
709-
PyRun_SimpleString("import sys; sys.path.pop(0)\n");
710-
711-
.. versionadded:: 3.1.3
712-
713-
.. XXX impl. doesn't seem consistent in allowing ``0``/``NULL`` for the params;
714-
check w/ Guido.
715-
716-
.. deprecated-removed:: 3.11 3.15
717-
718-
719-
.. c:function:: void PySys_SetArgv(int argc, wchar_t **argv)
720-
721-
This API is kept for backward compatibility: setting
722-
:c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should be used
723-
instead, see :ref:`Python Initialization Configuration <init-config>`.
724-
725-
This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set
726-
to ``1`` unless the :program:`python` interpreter was started with the
727-
:option:`-I`.
728-
729-
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
730-
:c:expr:`wchar_t*` string.
731-
732-
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
733-
members of the :ref:`Python Initialization Configuration <init-config>`.
734-
735-
.. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`.
736-
737-
.. deprecated-removed:: 3.11 3.15
738-
739-
740661
.. c:function:: void Py_SetPythonHome(const wchar_t *home)
741662
742663
This API is kept for backward compatibility: setting

Doc/data/refcounts.dat

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,15 +2242,6 @@ PySys_GetObject:const char*:name::
22422242

22432243
PySys_GetXOptions:PyObject*::0:
22442244

2245-
PySys_SetArgv:void:::
2246-
PySys_SetArgv:int:argc::
2247-
PySys_SetArgv:wchar_t**:argv::
2248-
2249-
PySys_SetArgvEx:void:::
2250-
PySys_SetArgvEx:int:argc::
2251-
PySys_SetArgvEx:wchar_t**:argv::
2252-
PySys_SetArgvEx:int:updatepath::
2253-
22542245
PySys_SetObject:int:::
22552246
PySys_SetObject:const char*:name::
22562247
PySys_SetObject:PyObject*:v:+1:

Doc/data/stable_abi.dat

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/sysmodule.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ PyAPI_FUNC(int) PySys_GetOptionalAttrString(const char *, PyObject **);
1313
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *);
1414
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *);
1515

16-
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
17-
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
18-
1916
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
2017
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
2118
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)

Lib/test/test_stable_abi_ctypes.py

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/NEWS.d/3.13.0b1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,8 +1625,8 @@ Restore functions removed in Python 3.13 alpha 1:
16251625

16261626
* :c:func:`Py_SetPythonHome`
16271627
* :c:func:`Py_SetProgramName`
1628-
* :c:func:`PySys_SetArgvEx`
1629-
* :c:func:`PySys_SetArgv`
1628+
* :c:func:`!PySys_SetArgvEx`
1629+
* :c:func:`!PySys_SetArgv`
16301630

16311631
Patch by Victor Stinner.
16321632

Misc/stable_abi.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,10 +1335,6 @@
13351335
abi_only = true
13361336
[function.PySys_ResetWarnOptions]
13371337
added = '3.2'
1338-
[function.PySys_SetArgv]
1339-
added = '3.2'
1340-
[function.PySys_SetArgvEx]
1341-
added = '3.2'
13421338
[function.PySys_SetObject]
13431339
added = '3.2'
13441340
[function.PySys_SetPath]

PC/python3dll.c

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/sysmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,7 +4235,8 @@ make_sys_argv(int argc, wchar_t * const * argv)
42354235
return list;
42364236
}
42374237

4238-
void
4238+
/* removed in 3.15, but kept for stable ABI compatibility */
4239+
PyAPI_FUNC(void)
42394240
PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)
42404241
{
42414242
wchar_t* empty_argv[1] = {L""};
@@ -4282,7 +4283,8 @@ PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)
42824283
}
42834284
}
42844285

4285-
void
4286+
/* removed in 3.15, but kept for stable ABI compatibility */
4287+
PyAPI_FUNC(void)
42864288
PySys_SetArgv(int argc, wchar_t **argv)
42874289
{
42884290
_Py_COMP_DIAG_PUSH

0 commit comments

Comments
 (0)