Skip to content

Fix crash during deserialization of callable types #3660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mypy/fixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def visit_callable_type(self, ct: CallableType) -> None:
for val in v.values:
val.accept(self)
v.upper_bound.accept(self)
for arg in ct.bound_args:
if arg:
arg.accept(self)

def visit_overloaded(self, t: Overloaded) -> None:
for ct in t.items():
Expand Down
20 changes: 20 additions & 0 deletions test-data/unit/check-serialize.test
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ def f(x: int,
[builtins fixtures/dict.pyi]
[out2]

[case testSerializeCallableWithBoundTypeArguments]
import a
[file a.py]
import b
[file a.py.2]
import b
x = b.f
[file b.py]
from typing import TypeVar, Generic

T = TypeVar('T')

class C(Generic[T]):
def f(self, x: T) -> None: pass

c: C[int]
f = c.f
[out]
[out2]

[case testSerializePositionalOnlyArgument]
import a
[file a.py]
Expand Down