mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 05:22:23 +08:00
fix odd version comparisons (#988)
"> (3,)" works but looks like the code is checking for Python 4. "<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater than (3, 5), so a hypothetical type checker that uses the full version info would interpret this check incorrectly. This ensures that all version_info comparisons use <, >=, ==, or !=.
This commit is contained in:
committed by
Guido van Rossum
parent
3e94c46e64
commit
984307bf45
@@ -67,7 +67,7 @@ class Path(PurePath):
|
||||
def iterdir(self) -> Generator[Path, None, None]: ...
|
||||
def lchmod(self, mode: int) -> None: ...
|
||||
def lstat(self) -> os.stat_result: ...
|
||||
if sys.version_info <= (3, 4):
|
||||
if sys.version_info < (3, 5):
|
||||
def mkdir(self, mode: int = ...,
|
||||
parents: bool = ...) -> None: ...
|
||||
else:
|
||||
@@ -79,7 +79,7 @@ class Path(PurePath):
|
||||
def owner(self) -> str: ...
|
||||
def rename(self, target: Union[str, PurePath]) -> None: ...
|
||||
def replace(self, target: Union[str, PurePath]) -> None: ...
|
||||
if sys.version_info <= (3, 5):
|
||||
if sys.version_info < (3, 6):
|
||||
def resolve(self: _P) -> _P: ...
|
||||
else:
|
||||
def resolve(self: _P, strict: bool = ...) -> _P: ...
|
||||
|
||||
Reference in New Issue
Block a user