Skip to content

Commit

Permalink
Remove try/except handing Python2
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 6, 2023
1 parent d688ff0 commit 28415b3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions IPython/lib/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,17 +841,8 @@ def _exception_pprint(obj, p, cycle):
if _env_type is not dict:
_type_pprinters[_env_type] = _dict_pprinter_factory('environ{', '}')

try:
# In PyPy, types.DictProxyType is dict, setting the dictproxy printer
# using dict.setdefault avoids overwriting the dict printer
_type_pprinters.setdefault(types.DictProxyType,
_dict_pprinter_factory('dict_proxy({', '})'))
_type_pprinters[types.ClassType] = _type_pprint
_type_pprinters[types.SliceType] = _repr_pprint
except AttributeError: # Python 3
_type_pprinters[types.MappingProxyType] = \
_dict_pprinter_factory('mappingproxy({', '})')
_type_pprinters[slice] = _repr_pprint
_type_pprinters[types.MappingProxyType] = _dict_pprinter_factory("mappingproxy({", "})")
_type_pprinters[slice] = _repr_pprint

_type_pprinters[range] = _repr_pprint
_type_pprinters[bytes] = _repr_pprint
Expand Down

0 comments on commit 28415b3

Please sign in to comment.