Skip to content

Commit

Permalink
Merge pull request #13181 from ichard26/bad-types
Browse files Browse the repository at this point in the history
Fix locate_file() type hints for older Pythons
  • Loading branch information
sbidoul authored Jan 26, 2025
2 parents 0d609f7 + a2022f1 commit 3e99c7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/13181.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Restore opt-in ``importlib.metadata`` backend support on Python 3.10 and lower
by fixing an unsupported type annotation.
3 changes: 2 additions & 1 deletion src/pip/_internal/metadata/importlib/_dists.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Mapping,
Optional,
Sequence,
Union,
cast,
)

Expand Down Expand Up @@ -96,7 +97,7 @@ def read_text(self, filename: str) -> Optional[str]:
raise UnsupportedWheel(error)
return text

def locate_file(self, path: str | PathLike[str]) -> pathlib.Path:
def locate_file(self, path: Union[str, "PathLike[str]"]) -> pathlib.Path:
# This method doesn't make sense for our in-memory wheel, but the API
# requires us to define it.
raise NotImplementedError
Expand Down

0 comments on commit 3e99c7c

Please sign in to comment.