summaryrefslogtreecommitdiffstats
path: root/Lib/xml
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-07-17 02:45:11 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-07-17 02:45:11 (GMT)
commit426e248febc4b86ea4512baaaa81966ab54c83da (patch)
treee328da11b7ab6473ef0e212e21d39b3fb2ceb025 /Lib/xml
parentdaa4c6b2e68c8ab0d929d9f00db45819431b4e3d (diff)
downloadcpython-426e248febc4b86ea4512baaaa81966ab54c83da.zip
cpython-426e248febc4b86ea4512baaaa81966ab54c83da.tar.gz
cpython-426e248febc4b86ea4512baaaa81966ab54c83da.tar.bz2
Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working
Diffstat (limited to 'Lib/xml')
-rw-r--r--Lib/xml/etree/ElementTree.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index 10bf849..3981659 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -1190,9 +1190,15 @@ def tostringlist(element, encoding=None, method=None):
def writable(self):
return True
+ def seekable(self):
+ return True
+
def write(self, b):
data.append(b)
+ def tell(self):
+ return len(data)
+
ElementTree(element).write(DataStream(), encoding, method=method)
return data