Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()

method doesn't require an argument again.
This commit is contained in:
Christian Heimes 2012-09-24 13:27:28 +02:00
commit 22340be15e
3 changed files with 14 additions and 1 deletions

View File

@ -641,6 +641,16 @@ class ForeignDTDTests(unittest.TestCase):
parser.Parse("<?xml version='1.0'?><element/>")
self.assertEqual(handler_call_args, [(None, None)])
# test UseForeignDTD() is equal to UseForeignDTD(True)
handler_call_args[:] = []
parser = expat.ParserCreate()
parser.UseForeignDTD()
parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
parser.ExternalEntityRefHandler = resolve_entity
parser.Parse("<?xml version='1.0'?><element/>")
self.assertEqual(handler_call_args, [(None, None)])
def test_ignore_use_foreign_dtd(self):
"""
If UseForeignDTD is passed True and a document with an external

View File

@ -71,6 +71,9 @@ Library
Extension Modules
-----------------
- Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
Tests
-----

View File

@ -1035,7 +1035,7 @@ xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args)
{
int flag = 1;
enum XML_Error rc;
if (!PyArg_ParseTuple(args, "p:UseForeignDTD", &flag))
if (!PyArg_ParseTuple(args, "|p:UseForeignDTD", &flag))
return NULL;
rc = XML_UseForeignDTD(self->itself, flag ? XML_TRUE : XML_FALSE);
if (rc != XML_ERROR_NONE) {