Skip to content

Commit

Permalink
Optional Callable is no more valid (python#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik authored and gvanrossum committed Aug 5, 2016
1 parent e39a50d commit 2050d80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mypy/typeanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
from mypy import experiments


type_constructors = {'typing.Tuple', 'typing.Union', 'typing.Callable', 'typing.Type'}
type_constructors = {
'typing.Callable',
'typing.Optional',
'typing.Tuple',
'typing.Type',
'typing.Union',
}


def analyze_type_alias(node: Node,
Expand Down
4 changes: 4 additions & 0 deletions test-data/unit/check-optional.test
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,7 @@ def f() -> None:
from typing import Callable
def f() -> None: pass
x = f # type: Callable[[], None]

[case testOptionalCallable]
from typing import Callable, Optional
T = Optional[Callable[..., None]]

0 comments on commit 2050d80

Please sign in to comment.