Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9c6c8d

Browse files
committed
Extend isclass() to work for extension classes (by looking for __bases__).
1 parent 324cc6e commit a9c6c8d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def isclass(object):
4444
Class objects provide these attributes:
4545
__doc__ documentation string
4646
__module__ name of module in which this class was defined"""
47-
return type(object) is types.ClassType
47+
return type(object) is types.ClassType or hasattr(object, '__bases__')
4848

4949
def ismethod(object):
5050
"""Return true if the object is an instance method.

0 commit comments

Comments
 (0)