[Python-bugs-list] [ python-Bugs-625698 ] Errors with recursive objects

noreply@sourceforge.net noreply@sourceforge.net
Sat, 19 Oct 2002 12:27:15 -0700


Bugs item #625698, was opened at 2002-10-19 19:27
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=625698&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Erik Andersén (erik_andersen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Errors with recursive objects

Initial Comment:
List and dictionaries put Python into an infinite loop if they contain 
more than one reference to itself

>>> d = {}
>>> d[1] = 
d
>>> d == d  # OK Python can handle one 
recursion
1
>>> d[2] = d 
>>> d == d  # Crash with 
two

Lists are similar

>>> l=[]
>>> 
l.append(l)
>>> l==l  # OK
1
>>> l.append(l)
>>> 
l==l # Crash

>>> l>l  # Also crash

Tested with 
ActivePython 2.2.1 under Windows 98
and (the first part) 
Python 2.2.2 under Linux


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=625698&group_id=5470