Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
>>> import ntpath
>>> ntpath.commonpath(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen ntpath>", line 826, in commonpath
ValueError: commonpath() arg is an empty sequenceExpected: TypeError: 'NoneType' object is not iterable like for posixpath.commonpath.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
[-]Raise TypeError for non-iterables for `ntpath.commonpath`[/-][+]Handle non-iterables for `ntpath.commonpath`[/+]serhiy-storchaka commentedon Mar 28, 2024
For reference,
posixpath.commonpath()was changed in #114709. I forget to check also thentpathimplementation. 🤦♂️nineteendo commentedon Mar 28, 2024
Yeah, I saw when your test failed when I changed
posixpath.commonpath().But don't feel too bad, it happens to the best of us.
nineteendo commentedon Mar 28, 2024
Maybe we could create
test_os_path.pyfor common tests betweenntpath&posixpath?That would've probably caught this earlier.
serhiy-storchaka commentedon Mar 28, 2024
Common tests are already defined in
test_genericpath.CommonTest.gh-117335: Handle non-iterables for `ntpath.commonpath` (GH-117336)
Squashed commit of the following:
Squashed commit of the following:
pythongh-117335: Handle non-iterables for `ntpath.commonpath` (python…