Add @final to many unsubclassable stdlib classes (#6299)

This commit is contained in:
Alex Waygood
2021-11-15 13:45:24 +00:00
committed by GitHub
parent 5b94c6a94d
commit 10c9d8cfce
17 changed files with 48 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import sys
from threading import Thread
from types import TracebackType
from typing import Any, Callable, NoReturn, Optional, Tuple, Type
from typing_extensions import final
error = RuntimeError
@@ -9,6 +10,7 @@ def _count() -> int: ...
_dangling: Any
@final
class LockType:
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
@@ -29,6 +31,7 @@ TIMEOUT_MAX: float
if sys.version_info >= (3, 8):
def get_native_id() -> int: ... # only available on some platforms
@final
class _ExceptHookArgs(Tuple[Type[BaseException], Optional[BaseException], Optional[TracebackType], Optional[Thread]]):
@property
def exc_type(self) -> Type[BaseException]: ...