diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 4005400..3fc2d0f 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -860,7 +860,7 @@ class Inspector(Colorable): if init_ds: out['init_docstring'] = init_ds - names = [sub.__name__ for sub in obj.__subclasses__()] + names = [sub.__name__ for sub in type.__subclasses__(obj)] if len(names) < 10: all_names = ', '.join(names) else: diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index 14c7c40..c992620 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -363,6 +363,12 @@ def test_pinfo_nonascii(): ip.user_ns['nonascii2'] = nonascii2 ip._inspect('pinfo', 'nonascii2', detail_level=1) +def test_pinfo_type(): + """ + type can fail in various edge case, for example `type.__subclass__()` + """ + ip._inspect('pinfo', 'type') + def test_pinfo_docstring_no_source(): """Docstring should be included with detail_level=1 if there is no source"""