Commit 6b590c7b authored by Christian Heimes's avatar Christian Heimes

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

method doesn't require an argument again.
parent 90fb338a
......@@ -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
......
......@@ -482,6 +482,9 @@ Library
Extension Modules
-----------------
- Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
- Issue #15676: Now "mmap" check for empty files before doing the
offset check. Patch by Steven Willis.
......
......@@ -1035,7 +1035,7 @@ xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args)
PyObject *flagobj = NULL;
int flag = 1;
enum XML_Error rc;
if (!PyArg_ParseTuple(args, "O:UseForeignDTD", &flagobj))
if (!PyArg_ParseTuple(args, "|O:UseForeignDTD", &flagobj))
return NULL;
if (flagobj != NULL) {
flag = PyObject_IsTrue(flagobj);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment