Catch an error with illegal class instances, fixes #1491

This commit is contained in:
Dave Halter
2020-02-03 22:27:48 +01:00
parent a49c757b8a
commit 3388a9659b
2 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -570,4 +570,6 @@ def _is_class_instance(obj):
except AttributeError:
return False
else:
return cls != type and not issubclass(cls, NOT_CLASS_TYPES)
# The isinstance check for cls is just there so issubclass doesn't
# raise an exception.
return cls != type and isinstance(cls, type) and not issubclass(cls, NOT_CLASS_TYPES)