From c7296a8ae5392f9aba794774f87048de48e81014 Mon Sep 17 00:00:00 2001 From: Hyunjun Kim Date: Wed, 11 Jan 2017 18:32:26 +0900 Subject: [PATCH] typing.Union handling fix. Addresses https://github.com/spoqa/tsukkomi/issues/16 Referenced https://github.com/The-Compiler/qutebrowser/commit/b6195d4e77e1309b4b4ecf77508a9ad65b007fcc --- tsukkomi/typed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsukkomi/typed.py b/tsukkomi/typed.py index 19e8e0a..cb3e9fc 100644 --- a/tsukkomi/typed.py +++ b/tsukkomi/typed.py @@ -43,7 +43,7 @@ def check_type(value: typing.Any, hint: typing.Optional[type]) -> bool: actual_type, correct = check_callable(value, hint) elif issubclass(hint, typing.Tuple): actual_type, correct = check_tuple(value, hint) - elif issubclass(hint, typing.Union): + elif type(hint) is type(typing.Union): # flake8: disable=E721 actual_type, correct = check_union(value, hint) else: correct = isinstance(value, hint)