]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
authorInada Naoki <songofacandy@gmail.com>
Fri, 26 Feb 2021 02:09:06 +0000 (11:09 +0900)
committerGitHub <noreply@github.com>
Fri, 26 Feb 2021 02:09:06 +0000 (11:09 +0900)
Lib/gzip.py
Lib/test/test_gzip.py

index 8002b43bde97cda3d45f681fcc1143bb341b5335..ee0cbed8f50d6d827099ce8d333403f6cbea8645 100644 (file)
@@ -583,7 +583,7 @@ def main():
                 g = sys.stdout.buffer
             else:
                 if arg[-3:] != ".gz":
-                    sys.exit("filename doesn't end in .gz:", repr(arg))
+                    sys.exit(f"filename doesn't end in .gz: {arg!r}")
                 f = open(arg, "rb")
                 g = builtins.open(arg[:-3], "wb")
         else:
index 1bb8f7a2d351c137e5bbc5cc5e80a491d76ffa32..1dcfa2b628a1ca72513aee9e731cb3c4eb655e44 100644 (file)
@@ -775,7 +775,7 @@ class TestCommandLine(unittest.TestCase):
 
     def test_decompress_infile_outfile_error(self):
         rc, out, err = assert_python_failure('-m', 'gzip', '-d', 'thisisatest.out')
-        self.assertIn(b"filename doesn't end in .gz:", err)
+        self.assertEqual(b"filename doesn't end in .gz: 'thisisatest.out'", err.strip())
         self.assertEqual(rc, 1)
         self.assertEqual(out, b'')