From a05dbbe2e30308dffc041eea739e74901086ce3f 2009-03-15 01:12:50 From: Robert Kern Date: 2009-03-15 01:12:50 Subject: [PATCH] BUG: Partial fix for the case of old-style extension types that do not descend from object, like the VTK types. Still need to work on getting a real MRO for them. --- diff --git a/IPython/external/pretty.py b/IPython/external/pretty.py index 3882308..6a7e855 100644 --- a/IPython/external/pretty.py +++ b/IPython/external/pretty.py @@ -293,8 +293,14 @@ def _get_mro(obj_class): """ if not hasattr(obj_class, '__mro__'): # Old-style class. Mix in object to make a fake new-style class. - obj_class = type(obj_class.__name__, (obj_class, object), {}) - mro = obj_class.__mro__[1:-1] + try: + obj_class = type(obj_class.__name__, (obj_class, object), {}) + except TypeError: + # Old-style extension type that does not descend from object. + # FIXME: try to construct a more thorough MRO. + mro = [obj_class] + else: + mro = obj_class.__mro__[1:-1] else: mro = obj_class.__mro__ return mro