]> granicus.if.org Git - python/commitdiff
Prevent an error when inspect.isabstract() is called with something else than a new...
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 8 Apr 2008 21:51:57 +0000 (21:51 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Tue, 8 Apr 2008 21:51:57 +0000 (21:51 +0000)
Lib/inspect.py

index 3f9199fe6cff9999382db78b0456175cf1ef3df8..b492514e4f497622eaeb959a41070c7e5cfb0985 100644 (file)
@@ -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.