bpo-33018: Improve issubclass() error checking and message. (GH-5944)
This improves error message for situations when a non-class is
checked w.r.t. an abstract base class.
diff --git a/Lib/_py_abc.py b/Lib/_py_abc.py
index 6f42ef3..3c3aa8e 100644
--- a/Lib/_py_abc.py
+++ b/Lib/_py_abc.py
@@ -107,6 +107,8 @@
def __subclasscheck__(cls, subclass):
"""Override for issubclass(subclass, cls)."""
+ if not isinstance(subclass, type):
+ raise TypeError('issubclass() arg 1 must be a class')
# Check cache
if subclass in cls._abc_cache:
return True