-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
subprocess.check_output() accept the check keyword argument #84677
Comments
The subprocess.check_output() raises TypeError when given the Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_output(['ls'], check=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
TypeError: run() got multiple values for keyword argument 'check' It should just use True as the default when it's not specified in kwargs. |
-1 check_output() should not accept check=False. Please only improve the error message. I would be fine with accepting check=True, too |
I thought about raising ValueError instead but |
IMHO it's both confusing and bad API design to have a function like validate_result(..., validate=False) Now a reviewer has to check that a developer uses the validate_result() function *and* the developer is not passing validate=False into the function. #64096 is also provides a new feature, so it cannot get into Python 3.7 and 3.8. |
Fair enough, I updated the PR to raise ValueError instead. |
Fixed with #64096 for Python 3.11. Thanks! ✨ 🍰 ✨ |
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: