Mailing List Archive

bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)
https://github.com/python/cpython/commit/9525a18b5bb317d9fb206c992ab62aa41559b0c8
commit: 9525a18b5bb317d9fb206c992ab62aa41559b0c8
branch: master
author: Inada Naoki <songofacandy@gmail.com>
committer: methane <songofacandy@gmail.com>
date: 2021-02-26T11:09:06+09:00
summary:

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

files:
M Lib/gzip.py
M Lib/test/test_gzip.py

diff --git a/Lib/gzip.py b/Lib/gzip.py
index 8002b43bde97c..ee0cbed8f50d6 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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:
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 1bb8f7a2d351c..1dcfa2b628a1c 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -775,7 +775,7 @@ def test_decompress_infile_outfile(self):

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'')


_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652) [ In reply to ]
https://github.com/python/cpython/commit/540749ed6d8e29a11368bc7f343baf7b7ea7e4a8
commit: 540749ed6d8e29a11368bc7f343baf7b7ea7e4a8
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: miss-islington <31488909+miss-islington@users.noreply.github.com>
date: 2021-02-25T18:36:27-08:00
summary:

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

(cherry picked from commit 9525a18b5bb317d9fb206c992ab62aa41559b0c8)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>

files:
M Lib/gzip.py
M Lib/test/test_gzip.py

diff --git a/Lib/gzip.py b/Lib/gzip.py
index 8002b43bde97c..ee0cbed8f50d6 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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:
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 66ae51acbff54..1af23c69b4bd7 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -773,7 +773,7 @@ def test_decompress_infile_outfile(self):

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'')


_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins
bpo-43316: gzip: Fix sys.exit() usage. (GH-24652) [ In reply to ]
https://github.com/python/cpython/commit/07ab490a7a966ce00a61bf56ccd0604434b143a5
commit: 07ab490a7a966ce00a61bf56ccd0604434b143a5
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: miss-islington <31488909+miss-islington@users.noreply.github.com>
date: 2021-02-25T18:36:49-08:00
summary:

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

(cherry picked from commit 9525a18b5bb317d9fb206c992ab62aa41559b0c8)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>

files:
M Lib/gzip.py
M Lib/test/test_gzip.py

diff --git a/Lib/gzip.py b/Lib/gzip.py
index 3dd8564bec35d..1101d35a5f1bd 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -575,7 +575,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:
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 4bbc7424eb8a5..5c70a9e726356 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -761,7 +761,7 @@ def test_decompress_infile_outfile(self):

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'')


_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins