diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-08 21:51:57 +0000 |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-08 21:51:57 +0000 |
commit | 24f3c5c646d26350e4de6a878fed3e6db1e4ff9a (patch) | |
tree | 38d19136d56f62e688e97d8f6d592fa9ad831512 | |
parent | 4b798bdf8ab3a4a4b3b11ea60a8f0b1c54e43224 (diff) | |
download | cpython-git-24f3c5c646d26350e4de6a878fed3e6db1e4ff9a.tar.gz |
Prevent an error when inspect.isabstract() is called with something else than a new-style class.
-rw-r--r-- | Lib/inspect.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 3f9199fe6c..b492514e4f 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -247,7 +247,7 @@ def isgenerator(object): def isabstract(object): """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): """Return all members of an object as (name, value) pairs sorted by name. |