summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-03-30 05:32:08 (GMT)
committerGitHub <noreply@github.com>2019-03-30 05:32:08 (GMT)
commit38f4e468d4b55551e135c67337c18ae142193ba8 (patch)
tree433c93866c531d982f4c700ffdfe80f49be1a407
parent7444daada1270c94501d5516ab1e553b5e2b9586 (diff)
downloadcpython-38f4e468d4b55551e135c67337c18ae142193ba8.zip
cpython-38f4e468d4b55551e135c67337c18ae142193ba8.tar.gz
cpython-38f4e468d4b55551e135c67337c18ae142193ba8.tar.bz2
bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602)
-rw-r--r--Doc/library/sys.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 0fa5bd4..52026f6 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -30,6 +30,12 @@ always available.
To loop over the standard input, or the list of files given on the
command line, see the :mod:`fileinput` module.
+ .. note::
+ On Unix, command line arguments are passed by bytes from OS. Python decodes
+ them with filesystem encoding and "surrogateescape" error handler.
+ When you need original bytes, you can get it by
+ ``[os.fsencode(arg) for arg in sys.argv]``.
+
.. data:: base_exec_prefix