From 24f3c5c646d26350e4de6a878fed3e6db1e4ff9a Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Tue, 8 Apr 2008 21:51:57 +0000 Subject: Prevent an error when inspect.isabstract() is called with something else than a new-style class. --- Lib/inspect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/inspect.py b/Lib/inspect.py index 3f9199f..b492514 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. -- cgit v0.12