GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `Pathlike` type hint is not respected · Issue #2085 · gitpython-developers/GitPython

Pathlike type hint is not respected #2085

New issue
Copy link
New issue
Copy link
Closed
#2086
Closed
Pathlike type hint is not respected#2085
#2086
Copy link

Description

@George-Ogden
George-Ogden
opened on Nov 27, 2025
Issue body actions

According to os.pathlike, there is a Pathlike.__fspath__() method. However, there are many places in the repository where this is ignored and str() is used instead.

Activity

  1. George-Ogden commented on Dec 1, 2025

    @George-Ogden
    George-Ogden
    on Dec 1, 2025
    ContributorAuthor
    More actions

    Example:

    import os
    from dataclasses import dataclass
    
    @dataclass
    class CustomPathlike:
        path: str
        def __fspath__(self) -> str:
            return self.path
    
    custom_pathlike = CustomPathlike("folder/file")
    str(custom_pathlike) # "CustomPathlike(path='folder/file')" - fails in "git add CustomPathlike(path='folder/file')"
    os.fspath(custom_pathlike) # "folder/file"  - works in "git add folder/file"
  2. Byron
    closed this as completedin #2086on Dec 6, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.