diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index 6e936726a48f..97ba17ae497d 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -1,3 +1,4 @@ +from types import TracebackType from typing import Any, Callable, NoReturn TIMEOUT_MAX: int @@ -14,7 +15,7 @@ class LockType: def __init__(self) -> None: ... def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... - def __exit__(self, typ: Any, val: Any, tb: Any) -> None: ... + def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... def release(self) -> bool: ... def locked(self) -> bool: ... diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 6674702dd2d4..cc0391f92bc4 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -123,7 +123,7 @@ class AbstractServer: def close(self) -> None: ... if sys.version_info >= (3, 7): async def __aenter__(self: Self) -> Self: ... - async def __aexit__(self, *exc: Any) -> None: ... + async def __aexit__(self, *exc: object) -> None: ... @abstractmethod def get_loop(self) -> AbstractEventLoop: ... @abstractmethod diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index d0edcbdcaeda..01b1c5b4591d 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -25,7 +25,7 @@ else: class _ContextManager: def __init__(self, lock: Lock | Semaphore) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class _ContextManagerMixin: # Apparently this exists to *prohibit* use as a context manager. diff --git a/stdlib/asyncio/windows_utils.pyi b/stdlib/asyncio/windows_utils.pyi index 35a44be509af..1156f905659e 100644 --- a/stdlib/asyncio/windows_utils.pyi +++ b/stdlib/asyncio/windows_utils.pyi @@ -31,7 +31,7 @@ if sys.platform == "win32": def __del__(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, t: type | None, v: BaseException | None, tb: TracebackType | None) -> None: ... + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... @property def handle(self) -> int: ... def fileno(self) -> int: ... diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index edaa67109952..6f15e461e007 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -31,6 +31,6 @@ class Profile: def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... if sys.version_info >= (3, 8): def __enter__(self: Self) -> Self: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__(self, *exc_info: object) -> None: ... def label(code: str | CodeType) -> _Label: ... # undocumented diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 7582258b4a70..05ceca4a3ae0 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -1,7 +1,7 @@ import datetime import sys +from collections.abc import Iterable, Sequence from time import struct_time -from typing import Any, Iterable, Sequence from typing_extensions import Literal __all__ = [ @@ -106,7 +106,7 @@ class HTMLCalendar(Calendar): class different_locale: def __init__(self, locale: _LocaleType) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class LocaleTextCalendar(TextCalendar): def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 1c11beec0c35..0bd4e515ce51 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -127,7 +127,7 @@ class FieldStorage: separator: str = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def __iter__(self) -> Iterator[str]: ... def __getitem__(self, key: str) -> Any: ... def getvalue(self, key: str, default: Any = ...) -> Any: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index ce2a92eef5ab..4967d01f90dc 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -4,6 +4,7 @@ from _typeshed import Self from abc import abstractmethod from collections.abc import Container, Iterable, Iterator, Sequence from logging import Logger +from types import TracebackType from typing import Any, Callable, Generic, Protocol, TypeVar, overload from typing_extensions import Literal, ParamSpec, SupportsIndex @@ -73,7 +74,9 @@ class Executor: def shutdown(self, wait: bool = ...) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool | None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> bool | None: ... def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ... @@ -127,4 +130,4 @@ class _AcquireFutures: futures: Iterable[Future[Any]] def __init__(self, futures: Iterable[Future[Any]]) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index c1b8b6b64434..a60f8811e0ac 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -217,9 +217,9 @@ if sys.version_info >= (3, 10): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... async def __aenter__(self) -> _T: ... - async def __aexit__(self, *exctype: Any) -> None: ... + async def __aexit__(self, *exctype: object) -> None: ... elif sys.version_info >= (3, 7): class nullcontext(AbstractContextManager[_T]): @@ -229,7 +229,7 @@ elif sys.version_info >= (3, 7): @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... - def __exit__(self, *exctype: Any) -> None: ... + def __exit__(self, *exctype: object) -> None: ... if sys.version_info >= (3, 11): _T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath) diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 787f75b8950a..a3b62948ca20 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -1,5 +1,6 @@ import sys from _typeshed import Self, StrOrBytesPath +from types import TracebackType from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator __all__ = [ @@ -98,7 +99,9 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]): def __del__(self) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... def __iter__(self: Self) -> Self: ... def __next__(self) -> AnyStr: ... if sys.version_info < (3, 11): diff --git a/stdlib/multiprocessing/sharedctypes.pyi b/stdlib/multiprocessing/sharedctypes.pyi index 50d5a3d71973..8b1b1c1cee6e 100644 --- a/stdlib/multiprocessing/sharedctypes.pyi +++ b/stdlib/multiprocessing/sharedctypes.pyi @@ -3,6 +3,7 @@ from collections.abc import Callable, Iterable, Sequence from ctypes import _CData, _SimpleCData, c_char from multiprocessing.context import BaseContext from multiprocessing.synchronize import _LockLike +from types import TracebackType from typing import Any, Generic, Protocol, TypeVar, overload from typing_extensions import Literal @@ -82,7 +83,9 @@ class SynchronizedBase(Generic[_CT]): def get_obj(self) -> _CT: ... def get_lock(self) -> _LockLike: ... def __enter__(self) -> bool: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None + ) -> None: ... class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): value: _T diff --git a/stdlib/nntplib.pyi b/stdlib/nntplib.pyi index 1b129b7ec609..cc48cb83ae4c 100644 --- a/stdlib/nntplib.pyi +++ b/stdlib/nntplib.pyi @@ -73,7 +73,7 @@ class NNTP: timeout: float = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getwelcome(self) -> str: ... def getcapabilities(self) -> dict[str, _list[str]]: ... def set_debuglevel(self, level: int) -> None: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index fe92649756a5..f88f3a87e2d0 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1021,7 +1021,7 @@ if sys.version_info >= (3, 8): def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], Any]) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def add_dll_directory(path: str) -> _AddedDllDirectory: ... if sys.platform == "linux": diff --git a/stdlib/runpy.pyi b/stdlib/runpy.pyi index 05e0ec65dc49..256f8dab14e9 100644 --- a/stdlib/runpy.pyi +++ b/stdlib/runpy.pyi @@ -9,13 +9,13 @@ class _TempModule: module: ModuleType def __init__(self, mod_name: str) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class _ModifiedArgv0: value: Any def __init__(self, value: Any) -> None: ... def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def run_module( mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... diff --git a/stdlib/selectors.pyi b/stdlib/selectors.pyi index c3fe7ec47ace..23a94a29a74d 100644 --- a/stdlib/selectors.pyi +++ b/stdlib/selectors.pyi @@ -27,7 +27,7 @@ class BaseSelector(metaclass=ABCMeta): @abstractmethod def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... class SelectSelector(BaseSelector): def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index 456c94362a8e..05e5a176d8ff 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import Self, StrOrBytesPath from datetime import date, datetime, time +from types import TracebackType from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, TypeVar from typing_extensions import Literal, final @@ -183,7 +184,9 @@ class Connection: def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, __type: type | None, __value: BaseException | None, __traceback: Any | None) -> Literal[False]: ... + def __exit__( + self, __type: type[BaseException] | None, __value: BaseException | None, __traceback: TracebackType | None + ) -> Literal[False]: ... class Cursor(Iterator[Any]): arraysize: Any diff --git a/stdlib/sunau.pyi b/stdlib/sunau.pyi index b5a16f5e282b..73aa8999caa1 100644 --- a/stdlib/sunau.pyi +++ b/stdlib/sunau.pyi @@ -33,7 +33,7 @@ class _sunau_params(NamedTuple): class Au_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> IO[bytes] | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -53,7 +53,7 @@ class Au_read: class Au_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ... diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index f522d206550d..359be6e49781 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -1,5 +1,6 @@ import socket from _typeshed import Self +from types import TracebackType from typing import Any, Callable, Match, Pattern, Sequence __all__ = ["Telnet"] @@ -113,4 +114,6 @@ class Telnet: self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 63c912f15b6f..f5cd4218cea0 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -1,6 +1,7 @@ import sys from _typeshed import Self from contextlib import _GeneratorContextManager +from types import TracebackType from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, overload from typing_extensions import Literal @@ -263,7 +264,9 @@ class _patch(Generic[_T]): temp_original: Any is_local: bool def __enter__(self) -> _T: ... - def __exit__(self, *exc_info: Any) -> None: ... + def __exit__( + self, __exc_type: type[BaseException] | None, __exc_value: BaseException | None, __traceback: TracebackType | None + ) -> None: ... def start(self) -> _T: ... def stop(self) -> None: ... @@ -275,7 +278,7 @@ class _patch_dict: def __call__(self, f: Any) -> Any: ... def decorate_class(self, klass: Any) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, *args: Any) -> Any: ... + def __exit__(self, *args: object) -> Any: ... start: Any stop: Any diff --git a/stdlib/wave.pyi b/stdlib/wave.pyi index 8c2edb5b19e2..de20c6c4f5d4 100644 --- a/stdlib/wave.pyi +++ b/stdlib/wave.pyi @@ -25,7 +25,7 @@ class _wave_params(NamedTuple): class Wave_read: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def getfp(self) -> BinaryIO | None: ... def rewind(self) -> None: ... def close(self) -> None: ... @@ -45,7 +45,7 @@ class Wave_read: class Wave_write: def __init__(self, f: _File) -> None: ... def __enter__(self: Self) -> Self: ... - def __exit__(self, *args: Any) -> None: ... + def __exit__(self, *args: object) -> None: ... def setnchannels(self, nchannels: int) -> None: ... def getnchannels(self) -> int: ... def setsampwidth(self, sampwidth: int) -> None: ...