From: Martin v. Löwis Date: Sun, 30 Sep 2001 20:15:41 +0000 (+0000) Subject: Properly detect recursive structures. Adopted from patch #465298. X-Git-Tag: v2.2.1c1~1528 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f12d755a82312673c35e8224b2bde7ced159c52;p=python Properly detect recursive structures. Adopted from patch #465298. --- diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index 9f96163be1..ea4f9323a9 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -490,6 +490,10 @@ class Marshaller: raise TypeError, "cannot marshal recursive data structures" self.memo[i] = None + def endcontainer(self, value): + if value: + del self.memo[id(value)] + def dump_array(self, value): self.container(value) write = self.write @@ -497,6 +501,7 @@ class Marshaller: for v in value: self.__dump(v) write("\n") + self.endcontainer(value) dispatch[TupleType] = dump_array dispatch[ListType] = dump_array @@ -513,6 +518,7 @@ class Marshaller: self.__dump(v) write("\n") write("\n") + self.endcontainer(value) dispatch[DictType] = dump_struct def dump_instance(self, value):