commit | d6da90f93d6d44365f5c9f6a2290be90ccfc8d60 | [log] [tgz] |
---|---|---|
author | Florent Xicluna <florent.xicluna@gmail.com> | Sat Jul 21 11:17:38 2012 +0200 |
committer | Florent Xicluna <florent.xicluna@gmail.com> | Sat Jul 21 11:17:38 2012 +0200 |
tree | 1354a065046686913cb29c1c8c8e0a6ea9e9dc79 | |
parent | b4bbee25b1e3f4bccac222f806b3138fb72439d6 [diff] [blame] |
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with unorderable key.
diff --git a/Lib/pprint.py b/Lib/pprint.py index b8417f5..ae96dde 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py
@@ -86,7 +86,11 @@ self.obj = obj def __lt__(self, other): - rv = self.obj.__lt__(other.obj) + try: + rv = self.obj.__lt__(other.obj) + except TypeError: + rv = NotImplemented + if rv is NotImplemented: rv = (str(type(self.obj)), id(self.obj)) < \ (str(type(other.obj)), id(other.obj))