mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +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
@@ -31,7 +31,7 @@ class Logger:
|
||||
def isEnabledFor(self, lvl: int) -> bool: ...
|
||||
def getEffectiveLevel(self) -> int: ...
|
||||
def getChild(self, suffix: str) -> 'Logger': ...
|
||||
if sys.version_info > (3,):
|
||||
if sys.version_info >= (3,):
|
||||
def debug(self, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
@@ -218,7 +218,7 @@ class LogRecord:
|
||||
class LoggerAdapter:
|
||||
def __init__(self, logger: Logger, extra: Mapping[str, Any]) -> None: ...
|
||||
def process(self, msg: Text, kwargs: MutableMapping[str, Any]) -> Tuple[str, MutableMapping[str, Any]]: ...
|
||||
if sys.version_info > (3,):
|
||||
if sys.version_info >= (3,):
|
||||
def debug(self, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
@@ -280,7 +280,7 @@ def getLoggerClass() -> type: ...
|
||||
if sys.version_info >= (3,):
|
||||
def getLogRecordFactory() -> Callable[..., LogRecord]: ...
|
||||
|
||||
if sys.version_info > (3,):
|
||||
if sys.version_info >= (3,):
|
||||
def debug(msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
|
||||
stack_info: bool = ..., extra: Dict[str, Any] = ...,
|
||||
**kwargs: Any) -> None: ...
|
||||
|
||||
@@ -180,7 +180,7 @@ class HTTPHandler(Handler):
|
||||
def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ...
|
||||
|
||||
|
||||
if sys.version_info > (3,):
|
||||
if sys.version_info >= (3,):
|
||||
class QueueHandler(Handler):
|
||||
def __init__(self, queue: Queue) -> None: ...
|
||||
def prepare(self, record: LogRecord) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user