Skip to content

importlib.util.spec_from_file_location accepts pathlib.Paths #3052

Closed

Description

@thejohnfreeman

I don't know in what version of Python this started, but importlib.util.spec_from_file_location accepts a pathlib.Path as the second argument, not just a str as mypy 0.701 seems to believe. Probably a quick fix for someone who knows the codebase better.

Activity

  1. added
    stubs: false positive
    on Jun 12, 2019
  2. srittau commented on Jun 12, 2019

    @srittau
    Collaborator

    Added in 3.6 according to the docs. Patches welcome!

  3. thejohnfreeman commented on Jun 12, 2019

    @thejohnfreeman
    ContributorAuthor

    @srittau If you can point me to the source file where spec_from_file_location is typed, and to the preferred PathLike or whatever type we need, I'll happily make the pull request.

  4. srittau commented on Jun 12, 2019

    @srittau
    Collaborator

    @thejohnfreeman spec_from_file_location is typed in master/stdlib/3/importlib/util.pyi. An example of how to type something like this, including the necessary version check can be found here.

  5. added a commit that references this issue on Jun 12, 2019
    e4a9cd5
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

    stubs: false positive

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions