]> granicus.if.org Git - python/commitdiff
Text.__init__(): Make sure the data parameter is a string (8-bit or
authorFred Drake <fdrake@acm.org>
Mon, 8 Jan 2001 04:04:34 +0000 (04:04 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 8 Jan 2001 04:04:34 +0000 (04:04 +0000)
                  Unicode); raise TypeError if not.

This closes SF bug #126866.

Lib/xml/dom/minidom.py

index 74c9664dfb0e9668686d80fa33db0f25a99cdab0..65af4c72315dab1c2d7165389f457b576628cda4 100644 (file)
@@ -553,6 +553,8 @@ class Text(Node):
     childNodeTypes = ()
     
     def __init__(self, data):
+        if type(data) not in _StringTypes:
+            raise TypeError, "node contents must be a string"
         Node.__init__(self)
         self.data = self.nodeValue = data