I'm not sure if this is a bug, or a known breaking change. I didn't find anything related in the changelog, except for a rewrite of abc. But hovever, I want this to be documented. In 3.7.0: import abc def f(): pass class A(metaclass=abc.ABCMeta): pass issubclass(f, A) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__ return _abc_subclasscheck(cls, subclass) TypeError: issubclass() arg 1 must be a class python up to 3.6 (including 2.7) happily return false. Found real world usage in osc-lib * https://github.com/openstack/osc-lib/blob/46e2fb0a58fc06cfce1bb535f432405767d6b78b/osc_lib/utils/__init__.py#L495 * https://storyboard.openstack.org/#!/story/2003322
Maybe this is just how it should have been working the entire time, and osc is just holding it wrong. Since: class B: pass issubclass(f, B) Traceback (most recent call last): File "", line 1, in TypeError: issubclass() arg 1 must be a class ... but: issubclass(B, A) False
This was a conscious decision (i.e we decided that the old inconsistency is a bug). See https://bugs.python.org/issue33018 for previous discussion. What is your use case? If it is critical, we can reconsider this.
I just realized this while trying to use the openstack command line tools on python3.7. After reading and the fact that even in python2 class B: pass def f(): pass issubclass(f, B) Traceback (most recent call last): File "", line 1, in TypeError: issubclass() arg 1 must be a class ... I am sure, the new behavior is the correct one. I would be totally fine with closing this issue, and hoping not too many code depend on the strange old behavior :)