diff --git a/stubs/contextvars/contextvars.pyi b/stubs/contextvars/contextvars.pyi index 044d8a43c..8ce52bdfe 100644 --- a/stubs/contextvars/contextvars.pyi +++ b/stubs/contextvars/contextvars.pyi @@ -7,6 +7,7 @@ if sys.version_info >= (3, 9): from types import GenericAlias _T = TypeVar("_T") +_D = TypeVar("_D") _P = ParamSpec("_P") @final @@ -17,7 +18,10 @@ class ContextVar(Generic[_T]): def __init__(self, name: str, *, default: _T) -> None: ... @property def name(self) -> str: ... - def get(self, default: _T = ...) -> _T: ... + @overload + def get(self) -> _T: ... + @overload + def get(self, default: _D | _T) -> _D | _T: ... def set(self, value: _T) -> Token[_T]: ... def reset(self, token: Token[_T]) -> None: ... if sys.version_info >= (3, 9):