]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41497: Fix potential UnicodeDecodeError in dis CLI (GH-21757)
authorKonge <zkonge@outlook.com>
Sat, 8 Aug 2020 03:03:09 +0000 (11:03 +0800)
committerGitHub <noreply@github.com>
Sat, 8 Aug 2020 03:03:09 +0000 (12:03 +0900)
Lib/dis.py
Misc/NEWS.d/next/Library/2020-08-07-06-06-29.bpo-41497.aBtsWz.rst [new file with mode: 0644]

index 10e5f7fb08ab21c521e08709b7d46751fa3aa5cc..e289e176c78ffd78ee6e42a6b41acc0298f63933 100644 (file)
@@ -542,7 +542,7 @@ def _test():
     import argparse
 
     parser = argparse.ArgumentParser()
-    parser.add_argument('infile', type=argparse.FileType(), nargs='?', default='-')
+    parser.add_argument('infile', type=argparse.FileType('rb'), nargs='?', default='-')
     args = parser.parse_args()
     with args.infile as infile:
         source = infile.read()
diff --git a/Misc/NEWS.d/next/Library/2020-08-07-06-06-29.bpo-41497.aBtsWz.rst b/Misc/NEWS.d/next/Library/2020-08-07-06-06-29.bpo-41497.aBtsWz.rst
new file mode 100644 (file)
index 0000000..2c863ed
--- /dev/null
@@ -0,0 +1 @@
+Fix potential UnicodeDecodeError in dis module.
\ No newline at end of file