summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpclib.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-09-30 20:15:41 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-09-30 20:15:41 (GMT)
commit5f12d755a82312673c35e8224b2bde7ced159c52 (patch)
treee0e4f9382c592ca7c6c753c6905612c16b859ede /Lib/xmlrpclib.py
parentaf5910f0259ae9667d23f7829de1298491704fee (diff)
downloadcpython-5f12d755a82312673c35e8224b2bde7ced159c52.zip
cpython-5f12d755a82312673c35e8224b2bde7ced159c52.tar.gz
cpython-5f12d755a82312673c35e8224b2bde7ced159c52.tar.bz2
Properly detect recursive structures. Adopted from patch #465298.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r--Lib/xmlrpclib.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index 9f96163..ea4f932 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("</data></array></value>\n")
+ self.endcontainer(value)
dispatch[TupleType] = dump_array
dispatch[ListType] = dump_array
@@ -513,6 +518,7 @@ class Marshaller:
self.__dump(v)
write("</member>\n")
write("</struct></value>\n")
+ self.endcontainer(value)
dispatch[DictType] = dump_struct
def dump_instance(self, value):