Skip to content

Commit 6b19ff7

Browse files
author
amaury.forgeotdarc
committed
Prevent an error when inspect.isabstract() is called with something else than a new-style class.
git-svn-id: http://svn.python.org/projects/python/trunk@62230 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent bb43571 commit 6b19ff7

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
@@ -247,7 +247,7 @@ def isgenerator(object):
247247

248248
def isabstract(object):
249249
"""Return true if the object is an abstract base class (ABC)."""
250-
return object.__flags__ & TPFLAGS_IS_ABSTRACT
250+
return isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT
251251

252252
def getmembers(object, predicate=None):
253253
"""Return all members of an object as (name, value) pairs sorted by name.

0 commit comments

Comments
 (0)