mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #9402: pyexpat uses Py_DECREF() instead of PyObject_DEL()
Fix a crash if Python is compiled in pydebug mode.
This commit is contained in:
parent
3d75d0cc92
commit
b4ba986a71
2 changed files with 27 additions and 15 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue