[New-bugs-announce] [issue3043] Recursion bug in deepcopy

Tyler Laing report at bugs.python.org
Thu Jun 5 23:03:50 CEST 2008


New submission from Tyler Laing <trinioler at gmail.com>:

With the following code:
class Vertex:
	def __init__(self, type):
		self.type = type
		self.color=-1
		self.edges=[]
		

class Edge:
	def __init__(self, V1, V2):
		self.vertexes=[V1, V2]
		V1.edges.append(self)
		V2.edges.append(self)

Where the references are cyclic(this is for a research project into
graph algorithms), and using deepcopy, even on a tiny graph of five
vertexes and 25 edges causes deepcopy to run into the recursion limit.
At the very least, it should warn it can't copy the indicated object, as
the references are cyclic. At the very most, it should be able to handle
complex cyclic references like this properly.

----------
components: Library (Lib)
messages: 67728
nosy: Zeroth
severity: normal
status: open
title: Recursion bug in deepcopy
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3043>
_______________________________________


More information about the New-bugs-announce mailing list