summaryrefslogtreecommitdiff
path: root/Lib/xml/dom/minidom.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-05-23 15:18:28 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-05-23 15:18:28 +0000
commit27e4a179f277b568f04d482765ab773068ae6ab6 (patch)
treed3e1911917a15ff77cbd5a1846064c6a28606d52 /Lib/xml/dom/minidom.py
parent8c255e4173cfc86ff7015b8f75dccf0d41b24003 (diff)
downloadcpython-git-27e4a179f277b568f04d482765ab773068ae6ab6.tar.gz
Issue #1390: Raise ValueError in toxml when an invalid comment would
otherwise be produced.
Diffstat (limited to 'Lib/xml/dom/minidom.py')
-rw-r--r--Lib/xml/dom/minidom.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index ae960330c5..02e82d9037 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -1128,6 +1128,8 @@ class Comment(Childless, CharacterData):
self.data = self.nodeValue = data
def writexml(self, writer, indent="", addindent="", newl=""):
+ if "--" in self.data:
+ raise ValueError("'--' is not allowed in a comment node")
writer.write("%s<!--%s-->%s" % (indent, self.data, newl))