]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 30 Mar 2019 05:38:14 +0000 (22:38 -0700)
committerGitHub <noreply@github.com>
Sat, 30 Mar 2019 05:38:14 +0000 (22:38 -0700)
(cherry picked from commit 38f4e468d4b55551e135c67337c18ae142193ba8)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Doc/library/sys.rst

index ace0e2808b184a67a6ffb1b711c1023d3a619faf..c2c653e00bebbca81fd33a83335680089dc0723f 100644 (file)
@@ -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