Skip to content

Stubs for filecmp are missing Pathlike arguments #3858

Closed
@BoboTiG

Description

@BoboTiG
Contributor

(Inspired from #2267)

Starting with Python 3.6, filecmp functions can handle path-like objects, including:

filecmp.cmp()
filecmp.cmpfiles()
filecmp.dircmp()

Reproduction:

import filecmp
from pathlib import Path

filecmp.dircmp(Path("/tmp"), "/tmp")
filecmp.cmp(Path("file1"), Path("file2"))

Will output:

error: Value of type variable "AnyStr" of "dircmp" cannot be "Path"
error: Argument 1 to "cmp" has incompatible type "Path"; expected "Union[bytes, str]"
error: Argument 2 to "cmp" has incompatible type "Path"; expected "Union[bytes, str]"

I will not have time to work on it, but I think it is a good thing to have a open issue for anyone wanting to give a hand.

Activity

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @srittau@BoboTiG@djb4ai

      Issue actions

        Stubs for filecmp are missing Pathlike arguments · Issue #3858 · python/typeshed