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

Unicode); raise TypeError if not.

This closes SF bug #126866.
This commit is contained in:
Fred Drake 2001-01-08 04:04:34 +00:00
parent 1c73323d6f
commit daa823ad9a

View 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