Skip to content

Commit 4ca0a63

Browse files
olmokramerJelleZijlstra
authored andcommitted
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.
1 parent 8b5d470 commit 4ca0a63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/3/curses/__init__.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import _curses
22
from _curses import * # noqa: F403
3-
from typing import Callable, Any, Sequence, Mapping
3+
from typing import TypeVar, Callable, Any, Sequence, Mapping
4+
5+
_T = TypeVar('_T')
46

57
LINES: int
68
COLS: int
79

810
def initscr() -> _curses._CursesWindow: ...
911
def start_color() -> None: ...
10-
def wrapper(func: Callable[..., Any], *arg: Any, **kwds: Any) -> None: ...
12+
def wrapper(func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...

0 commit comments

Comments
 (0)