]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-14156: Make argparse.FileType work correctly for binary file modes when...
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 18 Mar 2022 15:02:44 +0000 (17:02 +0200)
committerGitHub <noreply@github.com>
Fri, 18 Mar 2022 15:02:44 +0000 (17:02 +0200)
commit4d2099f455229b10f88846dbe9fe6debbee55356
tree3f91ca57a2ba599db4fb77eab7a766699a8aaeec
parenta12ef81231d65da5efbef4fa1434716270a19af6
[3.9] bpo-14156: Make argparse.FileType work correctly for binary file modes when argument is '-' (GH-13165) (GH-31979)

Also made modes containing 'a' or 'x' act the same as a mode containing 'w' when argument is '-'
(so 'a'/'x' return sys.stdout like 'w', and 'ab'/'xb' return sys.stdout.buffer like 'wb').
(cherry picked from commit eafec26ae5327bb23b6dace2650b074c3327dfa0)

Co-authored-by: MojoVampire <shadowranger+github@gmail.com>
Lib/argparse.py
Lib/test/test_argparse.py
Misc/NEWS.d/next/Library/2019-05-07-14-25-45.bpo-14156.0FaHXE.rst [new file with mode: 0644]