diff --git a/stdlib/3.7/contextvars.pyi b/stdlib/3.7/contextvars.pyi index 429d2037a..810b699b6 100644 --- a/stdlib/3.7/contextvars.pyi +++ b/stdlib/3.7/contextvars.pyi @@ -1,16 +1,20 @@ import sys -from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar +from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union, overload if sys.version_info >= (3, 9): from types import GenericAlias _T = TypeVar("_T") +_D = TypeVar("_D") 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: Union[_D, _T]) -> Union[_D, _T]: ... def set(self, value: _T) -> Token[_T]: ... def reset(self, token: Token[_T]) -> None: ... if sys.version_info >= (3, 9): diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index b3070038b..8319eb0b5 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -23,6 +23,7 @@ collections.abc.AsyncGenerator.ag_frame collections.abc.AsyncGenerator.ag_running contextvars.Context.__init__ contextvars.Context.get +contextvars.ContextVar.get copy.PyStringMap ctypes.CDLL.__init__ dataclasses.Field.__init__