Issue #21774: Fix incorrect variable in xml.dom.minidom

This commit is contained in:
Raymond Hettinger 2014-06-15 14:48:19 -07:00
parent ef8abfc082
commit 92a4055343
3 changed files with 12 additions and 1 deletions

View File

@ -1531,6 +1531,13 @@ class MinidomTest(unittest.TestCase):
num_children_after = len(doc.childNodes)
self.assertTrue(num_children_after == num_children_before - 1)
def testProcessingInstructionNameError(self):
# wrong variable in .nodeValue property will
# lead to "NameError: name 'data' is not defined"
doc = parse(tstfile)
pi = doc.createProcessingInstruction("y", "z")
pi.nodeValue = "crash"
def test_main():
run_unittest(MinidomTest)

View File

@ -976,7 +976,7 @@ class ProcessingInstruction(Childless, Node):
def _get_nodeValue(self):
return self.data
def _set_nodeValue(self, value):
self.data = data
self.data = value
nodeValue = property(_get_nodeValue, _set_nodeValue)
# nodeName is an alias for target

View File

@ -26,6 +26,10 @@ Library
run_forever() and run_until_complete() methods of asyncio.BaseEventLoop now
raise an exception if the event loop was closed.
- Issue #21774: Fixed NameError for an incorrect variable reference in the
XML Minidom code for creating processing instructions.
(Found and fixed by Claudiu Popa.)
- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths
before checking for a CGI script at that path.