Mark threading.(R)Lock as final (#9753)

These are actually factory functions: 128379b8cd/Lib/threading.py (L108)

The pure-Python version of `RLock` is, strictly-speaking, subclassable. But you're not *meant* to subclass `RLock`, even if you *can* with the pure-Python version: https://discuss.python.org/t/make-threading-lock-rlock-factory-functions-subclassable/24008/2
This commit is contained in:
Nikita Sobolev
2023-02-19 15:21:55 +03:00
committed by GitHub
parent a2fee5b30f
commit 1387a9efa9

View File

@@ -3,6 +3,7 @@ from _typeshed import ProfileFunction, TraceFunction
from collections.abc import Callable, Iterable, Mapping
from types import TracebackType
from typing import Any, TypeVar
from typing_extensions import final
_T = TypeVar("_T")
@@ -101,6 +102,7 @@ class Thread:
class _DummyThread(Thread):
def __init__(self) -> None: ...
@final
class Lock:
def __enter__(self) -> bool: ...
def __exit__(
@@ -110,6 +112,7 @@ class Lock:
def release(self) -> None: ...
def locked(self) -> bool: ...
@final
class _RLock:
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
def release(self) -> None: ...