]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)
authorGraham Inggs <ginggs@debian.org>
Fri, 15 Oct 2021 09:38:55 +0000 (11:38 +0200)
committerGitHub <noreply@github.com>
Fri, 15 Oct 2021 09:38:55 +0000 (12:38 +0300)
Strip trailing '\n'.

Lib/py_compile.py
Misc/NEWS.d/next/Library/2021-10-14-18-04-17.bpo-45428.mM2War.rst [new file with mode: 0644]

index 0f9b59025cee384de3ca66ec8bada37850226a86..388614e51b1847cbd81400d9ce48dd734e050e14 100644 (file)
@@ -190,7 +190,7 @@ def main():
     )
     args = parser.parse_args()
     if args.filenames == ['-']:
-        filenames = sys.stdin.readlines()
+        filenames = [filename.rstrip('\n') for filename in sys.stdin.readlines()]
     else:
         filenames = args.filenames
     for filename in filenames:
diff --git a/Misc/NEWS.d/next/Library/2021-10-14-18-04-17.bpo-45428.mM2War.rst b/Misc/NEWS.d/next/Library/2021-10-14-18-04-17.bpo-45428.mM2War.rst
new file mode 100644 (file)
index 0000000..556eca4
--- /dev/null
@@ -0,0 +1 @@
+Fix a regression in py_compile when reading filenames from standard input.
\ No newline at end of file