Prevent an error when inspect.isabstract() is called with something else than a new-style class.

This commit is contained in:
Amaury Forgeot d'Arc 2008-04-08 21:51:57 +00:00
parent 4b798bdf8a
commit 24f3c5c646
1 changed files with 1 additions and 1 deletions

View File

@ -247,7 +247,7 @@ def isgenerator(object):
def isabstract(object): def isabstract(object):
"""Return true if the object is an abstract base class (ABC).""" """Return true if the object is an abstract base class (ABC)."""
return object.__flags__ & TPFLAGS_IS_ABSTRACT return isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT
def getmembers(object, predicate=None): def getmembers(object, predicate=None):
"""Return all members of an object as (name, value) pairs sorted by name. """Return all members of an object as (name, value) pairs sorted by name.