summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pyexpat.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-09-10 22:25:19 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-09-10 22:25:19 (GMT)
commitb4ba986a7170ab02059a149737928b00d30fa306 (patch)
tree7a614269b0207f847b44cfc2c2f660723e404526 /Lib/test/test_pyexpat.py
parent3d75d0cc9244a8c2c1f31deb47f097409d36fefb (diff)
downloadcpython-b4ba986a7170ab02059a149737928b00d30fa306.zip
cpython-b4ba986a7170ab02059a149737928b00d30fa306.tar.gz
cpython-b4ba986a7170ab02059a149737928b00d30fa306.tar.bz2
Issue #9402: pyexpat uses Py_DECREF() instead of PyObject_DEL()
Fix a crash if Python is compiled in pydebug mode.
Diffstat (limited to 'Lib/test/test_pyexpat.py')
-rw-r--r--Lib/test/test_pyexpat.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 3898348..6f63d53 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -221,6 +221,25 @@ class InterningTest(unittest.TestCase):
# L should have the same string repeated over and over.
self.assertTrue(tag is entry)
+ def test_issue9402(self):
+ # create an ExternalEntityParserCreate with buffer text
+ class ExternalOutputter:
+ def __init__(self, parser):
+ self.parser = parser
+ self.parser_result = None
+
+ def ExternalEntityRefHandler(self, context, base, sysId, pubId):
+ external_parser = self.parser.ExternalEntityParserCreate("")
+ self.parser_result = external_parser.Parse("", 1)
+ return 1
+
+ parser = expat.ParserCreate(namespace_separator='!')
+ parser.buffer_text = 1
+ out = ExternalOutputter(parser)
+ parser.ExternalEntityRefHandler = out.ExternalEntityRefHandler
+ parser.Parse(data, 1)
+ self.assertEquals(out.parser_result, 1)
+
class BufferTextTest(unittest.TestCase):
def setUp(self):