diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index 49ee2ce..8cb51aa 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -753,7 +753,10 @@ _type_pprinters = { } try: - _type_pprinters[types.DictProxyType] = _dict_pprinter_factory('') + # In PyPy, types.DictProxyType is dict, setting the dictproxy printer + # using dict.setdefault avoids overwritting the dict printer + _type_pprinters.setdefault(types.DictProxyType, + _dict_pprinter_factory('')) _type_pprinters[types.ClassType] = _type_pprint _type_pprinters[types.SliceType] = _repr_pprint except AttributeError: # Python 3