mirror of
https://github.com/python/cpython.git
synced 2024-11-25 19:03:49 +08:00
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:
parent
1c73323d6f
commit
daa823ad9a
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user