mirror of https://github.com/python/cpython
Prevent an error when inspect.isabstract() is called with something else than a new-style class.
This commit is contained in:
parent
4b798bdf8a
commit
24f3c5c646
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue