From 1751faf573e4bfd1dfde44519156fda8853da004 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Mon, 3 Oct 2016 12:21:57 +0200 Subject: [PATCH] A quick fix for http://bugs.python.org/issue28339 --- python2/typing.py | 2 +- src/typing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python2/typing.py b/python2/typing.py index 8880a258..f6a73d70 100644 --- a/python2/typing.py +++ b/python2/typing.py @@ -978,7 +978,7 @@ def _valid_for_check(cls): raise TypeError("Class %r cannot be used with class " "or instance checks" % cls) if (cls.__origin__ is not None and - sys._getframe(3).f_globals['__name__'] != 'abc'): + sys._getframe(3).f_globals['__name__'] not in ['abc', 'functools']): raise TypeError("Parameterized generics cannot be used with class " "or instance checks") diff --git a/src/typing.py b/src/typing.py index 694cd93c..05b65b70 100644 --- a/src/typing.py +++ b/src/typing.py @@ -897,7 +897,7 @@ def _valid_for_check(cls): raise TypeError("Class %r cannot be used with class " "or instance checks" % cls) if (cls.__origin__ is not None and - sys._getframe(3).f_globals['__name__'] != 'abc'): + sys._getframe(3).f_globals['__name__'] not in ['abc', 'functools']): raise TypeError("Parameterized generics cannot be used with class " "or instance checks")