I need to determine if a class is abstract. The documentation of the inspect module indicates that inspect.isabstract should do this: https://docs.python.org/3/library/inspect.html
However, in python 3.8.6 I find that inspect.isabstract doesn't work the way I expect.
For instance, the following code, copied with slight modifications from https://github.com/python/cpython/blob/master/Lib/test/test_inspect.py:
import inspect
from abc import ABCMeta, abstractmethod
class AbstractClassExample(object):
__metaclass__ = ABCMeta
@abstractmethod
def foo(self):
pass
# Fails here
assert inspect.isabstract(AbstractClassExample)
The above code does work in python 2.7, but fails in python 3.8.6. Is this a bug in python 3.8.6, or did something change in how inspect.isabstract works?