mirror of
https://github.com/python/cpython.git
synced 2025-07-29 22:24:49 +00:00
make inspect.isabstract() always return a boolean; add a test for it, too #7069
This commit is contained in:
parent
ca2d2529ce
commit
c63457b18e
3 changed files with 26 additions and 1 deletions
|
@ -242,7 +242,7 @@ def isroutine(object):
|
|||
|
||||
def isabstract(object):
|
||||
"""Return true if the object is an abstract base class (ABC)."""
|
||||
return isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT
|
||||
return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT)
|
||||
|
||||
def getmembers(object, predicate=None):
|
||||
"""Return all members of an object as (name, value) pairs sorted by name.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue