Commit daa823ad authored by Fred Drake's avatar Fred Drake

Text.__init__(): Make sure the data parameter is a string (8-bit or

                  Unicode); raise TypeError if not.

This closes SF bug #126866.
parent 1c73323d
...@@ -553,6 +553,8 @@ class Text(Node): ...@@ -553,6 +553,8 @@ class Text(Node):
childNodeTypes = () childNodeTypes = ()
def __init__(self, data): def __init__(self, data):
if type(data) not in _StringTypes:
raise TypeError, "node contents must be a string"
Node.__init__(self) Node.__init__(self)
self.data = self.nodeValue = data self.data = self.nodeValue = data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment