1from cpython.type cimport PyType_IsSubtype
2
3class mylist(list): pass
4
5def test_issubtype(a, b):
6    """
7    >>> test_issubtype(mylist, list)
8    True
9    >>> test_issubtype(mylist, dict)
10    False
11
12    >>> o = object()
13    >>> test_issubtype(o, list)
14    Traceback (most recent call last):
15    ...
16    TypeError: Cannot convert object to type
17    """
18    return PyType_IsSubtype(a, b)
19