This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients jbylund, r.david.murray, serhiy.storchaka
Date 2015-04-04.18:43:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428173028.89.0.96623732751.issue20192@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-04-04 18:43:48serhiy.storchakasetrecipients: + serhiy.storchaka, r.david.murray, jbylund
2015-04-04 18:43:48serhiy.storchakasetmessageid: <1428173028.89.0.96623732751.issue20192@psf.upfronthosting.co.za>
2015-04-04 18:43:48serhiy.storchakalinkissue20192 messages
2015-04-04 18:43:48serhiy.storchakacreate