summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-06-15 21:50:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-06-15 21:50:39 (GMT)
commitf46933a42ffb5e164624900a9d70dace7fe543ae (patch)
tree3b4372d48823a5cf88212b04e5a28def2715fef9
parent354bffaec46367313d308c229f16094be4f74b19 (diff)
parent92a405534383927c48c8de2fc6bf06127ef2be78 (diff)
downloadcpython-f46933a42ffb5e164624900a9d70dace7fe543ae.zip
cpython-f46933a42ffb5e164624900a9d70dace7fe543ae.tar.gz
cpython-f46933a42ffb5e164624900a9d70dace7fe543ae.tar.bz2
merge
-rw-r--r--Lib/test/test_minidom.py7
-rw-r--r--Lib/xml/dom/minidom.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 5ab4bfe..2489ff7 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -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)
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 6f71631..c379a33 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -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