Skip to content

Commit 02e016f

Browse files
Remove assertion from TypeGuard serialization (#10486)
This came up in python/typeshed#5473: mypy started crashing when I made a function return TypeGuard[Type[Any]]. I wasn't able to reproduce this locally so far, but verified that removing the assertion fixes the crash.
1 parent c605579 commit 02e016f

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

mypy/types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,6 @@ def __eq__(self, other: object) -> bool:
12711271
def serialize(self) -> JsonDict:
12721272
# TODO: As an optimization, leave out everything related to
12731273
# generic functions for non-generic functions.
1274-
assert (self.type_guard is None
1275-
or isinstance(get_proper_type(self.type_guard), Instance)), str(self.type_guard)
12761274
return {'.class': 'CallableType',
12771275
'arg_types': [t.serialize() for t in self.arg_types],
12781276
'arg_kinds': self.arg_kinds,

0 commit comments

Comments
 (0)