bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)

(cherry picked from commit 9525a18b5b)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
This commit is contained in:
Miss Islington (bot) 2021-02-25 18:36:27 -08:00 committed by GitHub
parent adea9b86a9
commit 540749ed6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View 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:

View file

@ -773,7 +773,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'')