File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ class PurePath(PathLike[str]):
46
46
def __new__ (cls , * args : StrPath ) -> Self : ...
47
47
48
48
def __hash__ (self ) -> int : ...
49
- def __eq__ (self , other : object ) -> bool : ...
50
49
def __fspath__ (self ) -> str : ...
51
50
def __lt__ (self , other : PurePath ) -> bool : ...
52
51
def __le__ (self , other : PurePath ) -> bool : ...
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path , PureWindowsPath
4
+
5
+ if Path ("asdf" ) == Path ("asdf" ):
6
+ ...
7
+
8
+ # https://github.com/python/typeshed/issues/10661
9
+ # Provide a true positive error when comparing Path to str
10
+ # mypy should report a comparison-overlap error with --strict-equality,
11
+ # and pyright should report a reportUnnecessaryComparison error
12
+ if Path ("asdf" ) == "asdf" : # type: ignore
13
+ ...
14
+
15
+ # Errors on comparison here are technically false positives. However, this comparison is a little
16
+ # interesting: it can never hold true on Posix, but could hold true on Windows. We should experiment
17
+ # with more accurate __new__, such that we only get an error for such comparisons on platforms
18
+ # where they can never hold true.
19
+ if PureWindowsPath ("asdf" ) == Path ("asdf" ): # type: ignore
20
+ ...
You can’t perform that action at this time.
0 commit comments