FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-43316: gzip: Fix sys.exit() usage. by methane · Pull Request #24652 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion Lib/gzip.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_gzip.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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'')

Expand Down

Back | FazBrowse Home | New Git URL