-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
posixpath.commonpath: Check for empty iterables broken #114709
Comments
It did not supported arbitrary iterables initially, it only worked with sequences. Then in 3.6 it started working with non-empty iterables by accident, but it was not intentional change, it was an implementation detail. Accepting an arbitrary iterable is a new feature. This change can only go in future 3.13. |
Fix the exceptions raised by posixpath.commonpath Raise ValueError, not IndexError when passed an empty iterable. Raise TypeError, not ValueError when passed None.
Please revert the change in |
Thanks, done in #115639 |
…n#114710) Fix the exceptions raised by posixpath.commonpath Raise ValueError, not IndexError when passed an empty iterable. Raise TypeError, not ValueError when passed None.
…n#114710) Fix the exceptions raised by posixpath.commonpath Raise ValueError, not IndexError when passed an empty iterable. Raise TypeError, not ValueError when passed None.
Bug report
Bug description:
This came up in python/typeshed#11310: When passing an empty sequence to
commonpath()
, aValueError
is raised with an appropriate error message. When an "empty" iterable is passed, anIndexError
is raised instead, although iterables otherwise work fine:The fix is trivial, I'll send a PR. Technically this is an API change, though, although the old API is unexpected.
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: