Here is reproducible on 2.7 example:
>>> import pprint, datetime, test.test_datetime
>>> naive = datetime.datetime.utcnow()
>>> aware = datetime.datetime.utcnow().replace(tzinfo=test.test_datetime.FixedOffset(-300, "EST", 1))
>>> pprint.pprint({naive, aware})
set([Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 59, in pprint
printer.pprint(object)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 117, in pprint
self._format(object, self._stream, 0, 0, {}, 0)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 199, in _format
object = _sorted(object)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 82, in _sorted
return sorted(iterable)
TypeError: can't compare offset-naive and offset-aware datetimes
>>> pprint.pprint({naive: 'naive', aware: 'aware'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 59, in pprint
printer.pprint(object)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 117, in pprint
self._format(object, self._stream, 0, 0, {}, 0)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 140, in _format
rep = self._repr(object, context, level - 1)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 226, in _repr
self._depth, level)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 238, in format
return _safe_repr(object, context, maxlevels, level)
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 280, in _safe_repr
for k, v in _sorted(object.items()):
File "/home/serhiy/py/cpython2.7/Lib/pprint.py", line 82, in _sorted
return sorted(iterable)
TypeError: can't compare offset-naive and offset-aware datetimes
|