[Python-checkins] r62230 - python/trunk/Lib/inspect.py

amaury.forgeotdarc python-checkins at python.org
Tue Apr 8 23:51:57 CEST 2008


Author: amaury.forgeotdarc
Date: Tue Apr  8 23:51:57 2008
New Revision: 62230

Modified:
   python/trunk/Lib/inspect.py
Log:
Prevent an error when inspect.isabstract() is called with something else than a new-style class.


Modified: python/trunk/Lib/inspect.py
==============================================================================
--- python/trunk/Lib/inspect.py	(original)
+++ python/trunk/Lib/inspect.py	Tue Apr  8 23:51:57 2008
@@ -247,7 +247,7 @@
 
 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.


More information about the Python-checkins mailing list