[Python-checkins] cpython (merge 3.2 -> default): Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
christian.heimes
python-checkins at python.org
Mon Sep 24 13:28:24 CEST 2012
http://hg.python.org/cpython/rev/0f55ad9b07c8
changeset: 79139:0f55ad9b07c8
parent: 79136:3d9c323711d0
parent: 79137:22ddf77e0497
user: Christian Heimes <christian at cheimes.de>
date: Mon Sep 24 13:27:28 2012 +0200
summary:
Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
files:
Lib/test/test_pyexpat.py | 10 ++++++++++
Misc/NEWS | 3 +++
Modules/pyexpat.c | 2 +-
3 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -641,6 +641,16 @@
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
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -71,6 +71,9 @@
Extension Modules
-----------------
+- Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
+ method doesn't require an argument again.
+
Tests
-----
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1035,7 +1035,7 @@
{
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) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list