From: Amaury Forgeot d'Arc Date: Tue, 8 Apr 2008 21:51:57 +0000 (+0000) Subject: Prevent an error when inspect.isabstract() is called with something else than a new... X-Git-Tag: v2.6a3~240 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24f3c5c646d26350e4de6a878fed3e6db1e4ff9a;p=python Prevent an error when inspect.isabstract() is called with something else than a new-style class. --- 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.