Skip to content

Stubs for filecmp are missing Pathlike for common argument #7034

Closed
@bersbersbers

Description

@bersbersbers

bug.py:

"""Demo mypy bug."""
import filecmp
from pathlib import Path

d = Path.home()
filecmp.cmpfiles(d, d, d.glob("*"))

mypy bug.py:

bug.py:6: error: Value of type variable "AnyStr" of "cmpfiles" cannot be "Path"
Found 1 error in 1 file (checked 1 source file)

I guess common should be Iterable[AnyStr | PathLike[AnyStr]]:

def cmpfiles(
a: AnyStr | PathLike[AnyStr], b: AnyStr | PathLike[AnyStr], common: Iterable[AnyStr], shallow: int | bool = ...
) -> tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ...

Related: #3858, #3864

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions