[New-bugs-announce] [issue9826] OrderedDict ref cycles break repr()

jason kirtland report at bugs.python.org
Fri Sep 10 21:10:02 CEST 2010

New submission from jason kirtland <jek at discorporate.us>:

repr of circular graphs of collections.OrderedDicts fails with 'RuntimeError: maximum recursion depth exceeded while calling a Python object'.

>>> from collections import OrderedDict
>>> left, right = OrderedDict(), OrderedDict()
>>> left['other'] = right
>>> right['other'] = left
>>> left
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lib/python2.7/collections.py", line 137, in __repr__
    return '%s(%r)' % (self.__class__.__name__, self.items())
RuntimeError: maximum recursion depth exceeded in __subclasscheck__

components: Library (Lib)
files: odictcyclerepr.py
messages: 116037
nosy: jek
priority: normal
severity: normal
status: open
title: OrderedDict ref cycles break repr()
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file18835/odictcyclerepr.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list