mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
Require warning categories to be subclasses of Warning (#343)
CPython _warnings module implementation accepts Warning subclasses and None, but not any subclass of BaseException specified in the stub. The stub for warnings is correct.
This commit is contained in:
committed by
Łukasz Langa
parent
5ba1a01216
commit
2ffee9df1b
@@ -1,11 +1,11 @@
|
||||
from typing import Any, List
|
||||
from typing import Any, List, Optional, Type
|
||||
|
||||
default_action = ... # type: str
|
||||
filters = ... # type: List[tuple]
|
||||
once_registry = ... # type: dict
|
||||
|
||||
def warn(message: Warning, category: type = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: type,
|
||||
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
|
||||
filename: str, lineno: int,
|
||||
module: Any = ..., registry: dict = ...,
|
||||
module_globals: dict = ...) -> None: ...
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, List
|
||||
from typing import Any, List, Optional, Type
|
||||
|
||||
_defaultaction = ... # type: str
|
||||
_onceregistry = ... # type: dict
|
||||
filters = ... # type: List[tuple]
|
||||
|
||||
def warn(message: Warning, category: type = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: type,
|
||||
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
|
||||
filename: str, lineno: int,
|
||||
module: Any = ..., registry: dict = ...,
|
||||
module_globals: dict = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user