New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python -m gzip handles error incorrectly #87482
Comments
The problem is how this error is thrown.
This is not the behaviour that is expected when using python -m gzip in a script. The error is even codified in a test: Line 776 in 1f43340
def test_decompress_infile_outfile_error(self):
rc, out, err = assert_python_ok('-m', 'gzip', '-d', 'thisisatest.out')
self.assertIn(b"filename doesn't end in .gz:", out)
self.assertEqual(rc, 0)
self.assertEqual(err, b'') This should be assert_python_failure, out and err should be swapped, and exit code should be something different than 0. From the zen of python: Errors should never pass silently. I am willing to fix this in a PR, but first I would like some feedback on how to solve this exactly. I propose raising a ValueError("can not determine output filename: 'myfile' does not end in '.gz'"). |
I prefer |
That sounds perfect, I didn't think of that. I will make a PR. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: