Skip to content

Commit a2022f1

Browse files
committed
Fix locate_file() type hints for older Pythons
🤦
1 parent 984c399 commit a2022f1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

news/13181.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Restore opt-in ``importlib.metadata`` backend support on Python 3.10 and lower
2+
by fixing an unsupported type annotation.

src/pip/_internal/metadata/importlib/_dists.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Mapping,
1212
Optional,
1313
Sequence,
14+
Union,
1415
cast,
1516
)
1617

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

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

0 commit comments

Comments
 (0)