From 6142c8e633d4eb3d575c2333afdbe31796dcc61b 2016-07-29 21:58:57 From: Danilo J. S. Bellini Date: 2016-07-29 21:58:57 Subject: [PATCH] Consistent pretty(a_class) on bogus qualname/name +1 test passing in PyPy --- diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index 0393121..057d1ee 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -670,8 +670,10 @@ def _type_pprint(obj, p, cycle): # Heap allocated types might not have the module attribute, # and others may set it to None. - # Checks for a __repr__ override in the metaclass - if type(obj).__repr__ is not type.__repr__: + # Checks for a __repr__ override in the metaclass. Can't compare the + # type(obj).__repr__ directly because in PyPy the representation function + # inherited from type isn't the same type.__repr__ + if [m for m in _get_mro(type(obj)) if "__repr__" in vars(m)][:1] != [type]: _repr_pprint(obj, p, cycle) return