[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>
pp.pprint(myset)
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:
#!/usr/bin/python
import pprint
pp = pprint.PrettyPrinter(indent=4)
myset = set(xrange(3))
myset.add(frozenset(xrange(10)))
pp.pprint(myset)
----------
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>
<http://bugs.python.org/issue20192>
_______________________________________
More information about the New-bugs-announce
mailing list