Skip to content

Handle non-iterables for ntpath.commonpath #117335

Closed

Description

@nineteendo

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 sequence

Expected: TypeError: 'NoneType' object is not iterable like for posixpath.commonpath.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Activity

  1. changed the title [-]Raise TypeError for non-iterables for `ntpath.commonpath`[/-] [+]Handle non-iterables for `ntpath.commonpath`[/+] on Mar 28, 2024
  2. serhiy-storchaka commented on Mar 28, 2024

    @serhiy-storchaka
    Member

    For reference, posixpath.commonpath() was changed in #114709. I forget to check also the ntpath implementation. 🤦‍♂️

  3. nineteendo commented on Mar 28, 2024

    @nineteendo
    ContributorAuthor

    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.

  4. nineteendo commented on Mar 28, 2024

    @nineteendo
    ContributorAuthor

    Maybe we could create test_os_path.py for common tests between ntpath & posixpath?
    That would've probably caught this earlier.

  5. serhiy-storchaka commented on Mar 28, 2024

    @serhiy-storchaka
    Member

    Common tests are already defined in test_genericpath.CommonTest.

  6. added a commit that references this issue on Mar 28, 2024
  7. added a commit that references this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions