[New-bugs-announce] [issue20192] pprint chokes on set containing frozenset

Joseph Bylund report at bugs.python.org
Wed Jan 8 18:37:11 CET 2014

New submission from Joseph Bylund:

Expected: pprint the object
Observed: crash with:
set([Traceback (most recent call last):
  File "./test.py", line 7, in <module>
  File "/usr/lib/python2.7/pprint.py", line 117, in pprint
    self._format(object, self._stream, 0, 0, {}, 0)
  File "/usr/lib/python2.7/pprint.py", line 194, in _format
    object = _sorted(object)
  File "/usr/lib/python2.7/pprint.py", line 82, in _sorted
    return sorted(iterable)
TypeError: can only compare to a set

Steps to repro:
import pprint
pp = pprint.PrettyPrinter(indent=4)

myset = set(xrange(3))

messages: 207693
nosy: jbylund
priority: normal
severity: normal
status: open
title: pprint chokes on set containing frozenset
type: crash
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list