diff --git a/python2/typing.py b/python2/typing.py index 8880a2586..f6a73d706 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 694cd93cd..05b65b70c 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")