-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Raise TypeError for non-paths in posixpath.relpath()
#117584
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
Changing the exception type is a backwards-incompatible change; some people will need to rewrite their exception handling to adapt to the new behaviour. Do the pros outweigh the cons? |
This is the same thing we did with non-iterables in |
I'll defer to Serhiy, who is particularly interested in such cases. cc. @serhiy-storchaka |
We usually do not bother with checking arguments more than necessary, especially in the Python code (which do not crash if you use wrong types or values). If the code happens to work outside the purposed area, well, someone can use it. If it fails with a weird error -- just do not do it. But in this case the change has zero performance cost, and TypeError is more suitable for |
Bug report
Bug description:
Expected: TypeError like
npath.relpath()
.CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
posixpath.relpath()
#117585The text was updated successfully, but these errors were encountered: