mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #22721: An order of multiline pprint output of set or dict containing
orderable and non-orderable elements no longer depends on iteration order of set or dict.
This commit is contained in:
parent
01362da7d0
commit
62aa7dc7c9
3 changed files with 46 additions and 7 deletions
|
@ -86,14 +86,10 @@ class _safe_key:
|
|||
|
||||
def __lt__(self, other):
|
||||
try:
|
||||
rv = self.obj.__lt__(other.obj)
|
||||
return self.obj < 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))
|
||||
return rv
|
||||
return ((str(type(self.obj)), id(self.obj)) < \
|
||||
(str(type(other.obj)), id(other.obj)))
|
||||
|
||||
def _safe_tuple(t):
|
||||
"Helper function for comparing 2-tuples"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue