-
-
Notifications
You must be signed in to change notification settings - Fork 937
Don't use assert to enforce interface constraints #1552
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
Comments
Thanks for bringing this up! A PR with a fix is definitely welcome. |
What kind of fix should be done for this? As in the example given above where Changing it may break existing code that uses GitPython, delegates validating those preconditions to the function being called, and catches Such breakage could nonetheless be avoided--assuming the behavior without |
I'd also think that exceptions shouldn't be assumed as part of the API unless they are documented, which would make it possible remove the assertion entirely. Thus, removing the these type assertions would be preferred here. |
GitPython/git/util.py
Line 1087 in c84dde2
assert
should not be used in product code because it can be ignored with-O
:(In fact, that behavior is probably better since a
TypeError
is more semantically meaningful.)bandit
can catch this kind of thing:The text was updated successfully, but these errors were encountered: