Skip to content

Commit 07ab490

Browse files
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
(cherry picked from commit 9525a18) Co-authored-by: Inada Naoki <[email protected]>
1 parent 69906c5 commit 07ab490

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Lib/gzip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def main():
575575
g = sys.stdout.buffer
576576
else:
577577
if arg[-3:] != ".gz":
578-
sys.exit("filename doesn't end in .gz:", repr(arg))
578+
sys.exit(f"filename doesn't end in .gz: {arg!r}")
579579
f = open(arg, "rb")
580580
g = builtins.open(arg[:-3], "wb")
581581
else:

Lib/test/test_gzip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ def test_decompress_infile_outfile(self):
761761

762762
def test_decompress_infile_outfile_error(self):
763763
rc, out, err = assert_python_failure('-m', 'gzip', '-d', 'thisisatest.out')
764-
self.assertIn(b"filename doesn't end in .gz:", err)
764+
self.assertEqual(b"filename doesn't end in .gz: 'thisisatest.out'", err.strip())
765765
self.assertEqual(rc, 1)
766766
self.assertEqual(out, b'')
767767

0 commit comments

Comments
 (0)