bpo-23427: Add sys.orig_argv attribute (GH-20729)
Add sys.orig_argv attribute: the list of the original command line
arguments passed to the Python executable.
Rename also PyConfig._orig_argv to PyConfig.orig_argv and
document it.
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index 9b0728d..84064d9 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -424,6 +424,8 @@
:c:member:`~PyConfig.argv` is empty, an empty string is added to ensure
that :data:`sys.argv` always exists and is never empty.
+ See also the :c:member:`~PyConfig.orig_argv` member.
+
.. c:member:: wchar_t* base_exec_prefix
:data:`sys.base_exec_prefix`.
@@ -586,6 +588,23 @@
* 1: Remove assertions, set ``__debug__`` to ``False``
* 2: Strip docstrings
+ .. c:member:: PyWideStringList orig_argv
+
+ The list of the original command line arguments passed to the Python
+ executable.
+
+ If :c:member:`~PyConfig.orig_argv` list is empty and
+ :c:member:`~PyConfig.argv` is not a list only containing an empty
+ string, :c:func:`PyConfig_Read()` copies :c:member:`~PyConfig.argv` into
+ :c:member:`~PyConfig.orig_argv` before modifying
+ :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig.parse_argv` is
+ non-zero).
+
+ See also the :c:member:`~PyConfig.argv` member and the
+ :c:func:`Py_GetArgcArgv` function.
+
+ .. versionadded:: 3.10
+
.. c:member:: int parse_argv
If non-zero, parse :c:member:`~PyConfig.argv` the same way the regular
@@ -982,6 +1001,8 @@
Get the original command line arguments, before Python modified them.
+ See also :c:member:`PyConfig.orig_argv` member.
+
Multi-Phase Initialization Private Provisional API
--------------------------------------------------