mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
This commit is contained in:
parent
3150754f91
commit
9525a18b5b
2 changed files with 2 additions and 2 deletions
|
@ -583,7 +583,7 @@ def main():
|
||||||
g = sys.stdout.buffer
|
g = sys.stdout.buffer
|
||||||
else:
|
else:
|
||||||
if arg[-3:] != ".gz":
|
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")
|
f = open(arg, "rb")
|
||||||
g = builtins.open(arg[:-3], "wb")
|
g = builtins.open(arg[:-3], "wb")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -775,7 +775,7 @@ class TestCommandLine(unittest.TestCase):
|
||||||
|
|
||||||
def test_decompress_infile_outfile_error(self):
|
def test_decompress_infile_outfile_error(self):
|
||||||
rc, out, err = assert_python_failure('-m', 'gzip', '-d', 'thisisatest.out')
|
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(rc, 1)
|
||||||
self.assertEqual(out, b'')
|
self.assertEqual(out, b'')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue