diff -r 4a48450f2505 Lib/test/test_minidom.py --- a/Lib/test/test_minidom.py Sat Jun 14 20:41:22 2014 -0700 +++ b/Lib/test/test_minidom.py Mon Jun 16 00:00:05 2014 +0300 @@ -1531,6 +1531,13 @@ 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) diff -r 4a48450f2505 Lib/xml/dom/minidom.py --- a/Lib/xml/dom/minidom.py Sat Jun 14 20:41:22 2014 -0700 +++ b/Lib/xml/dom/minidom.py Mon Jun 16 00:00:05 2014 +0300 @@ -976,7 +976,7 @@ 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