Catch an error with illegal class instances, fixes #1491

This commit is contained in:
Dave Halter committed 2020-02-03 22:27:22 +01:00
1 parent 2c62166ff6
commit eb88c483fb
2 files changed
+13 -1

No files matched your search

+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)