diff options
author | Victor Stinner <vstinner@python.org> | 2020-06-29 22:49:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 22:49:03 (GMT) |
commit | dd8a93e23b5c4f9290e1cea6183d97eb9b5e61c0 (patch) | |
tree | e313d1898cff674146bfb1fef17f082f56628ed4 /Doc/c-api | |
parent | 2fb5f038f2a2e91a7293d62dfd5601e6eb500c55 (diff) | |
download | cpython-dd8a93e23b5c4f9290e1cea6183d97eb9b5e61c0.zip cpython-dd8a93e23b5c4f9290e1cea6183d97eb9b5e61c0.tar.gz cpython-dd8a93e23b5c4f9290e1cea6183d97eb9b5e61c0.tar.bz2 |
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.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/init_config.rst | 21 |
1 files changed, 21 insertions, 0 deletions
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 @@ PyConfig :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 @@ PyConfig * 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 @@ Py_GetArgcArgv() Get the original command line arguments, before Python modified them. + See also :c:member:`PyConfig.orig_argv` member. + Multi-Phase Initialization Private Provisional API -------------------------------------------------- |