From 4ca0a63027e01698313284c29c49a0dc611efeff Mon Sep 17 00:00:00 2001 From: Olmo Kramer Date: Wed, 1 Aug 2018 16:57:45 +0200 Subject: [PATCH] Relate _curses.wrapper return type to its function arg (#2353) `curses.wrapper` returns the return value of the function it is passed, but its function argument is declared as `Callable[..., Any]` while its return type is `None`. This changes the definition of `curses.wrapper` to use a `TypeVar` that relates the return type of its function argument to its own return type. --- stdlib/3/curses/__init__.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/3/curses/__init__.pyi b/stdlib/3/curses/__init__.pyi index d79727aaf..a8d6df47f 100644 --- a/stdlib/3/curses/__init__.pyi +++ b/stdlib/3/curses/__init__.pyi @@ -1,10 +1,12 @@ import _curses from _curses import * # noqa: F403 -from typing import Callable, Any, Sequence, Mapping +from typing import TypeVar, Callable, Any, Sequence, Mapping + +_T = TypeVar('_T') LINES: int COLS: int def initscr() -> _curses._CursesWindow: ... def start_color() -> None: ... -def wrapper(func: Callable[..., Any], *arg: Any, **kwds: Any) -> None: ... +def wrapper(func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...