This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: pyexpat has no unit tests for UseForeignDTD functionality
Type: enhancement Stage: resolved
Components: Library (Lib), Tests, XML Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: exarkun, loewis, pitrou, sandro.tosi
Priority: normal Keywords: patch

Created on 2009-03-13 16:51 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
use-foreign-dtd.patch exarkun, 2009-03-13 16:50 review
use-foreign-dtd.2.patch exarkun, 2009-03-13 19:11 review
pyexpat.patch exarkun, 2009-05-20 18:41 review
issue5485-py3k.patch sandro.tosi, 2011-01-05 16:56
Messages (12)
msg83521 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-03-13 16:50
Lacking unit tests for this (documented) functionality makes it harder
for alternate Python runtimes to correctly provide it.  Plus, if it's
not tested, it might not work.

I tried to write tests for the feature since I recently used it and
thought it would be pretty straightforward.  However, I failed.  expat
inscrutably refuses to call the external entity ref handler I provided
in my test.  Attached is my attempted, in case anyone feels like helping
complete it.
msg83525 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-03-13 18:20
You need to make two changes:
1. Enable parsing of parameter entities in the first place, e.g. through
2. Pass a well-formed document, e.g.
"<?xml version='1.0'?><element/>"
msg83527 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-03-13 18:32
Thanks, that helped a bunch.  I'm sure it would have taken me a long
time to find SetParamEntityParsing(XML_PARAM_ENTITY_PARSING_ALWAYS). 
Perhaps it would also be good to expand the pyexpat documentation to
cover that method and parameter (unless it's there already and I missed
it, but I don't think so).
msg83530 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-03-13 19:09
Can you provide an update patch?
msg83531 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-03-13 19:11
Here's the version I have now.  I don't think it's complete, but it
finishes the test started in the previous patch, and the test passes.
msg83532 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-03-13 19:12
To clarify, I'll probably work on this patch a bit more later, adding a
few more tests for related behavior.
msg88130 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-05-20 18:41
Here's a new patch which adds SetParamEntityParsing to the pyexpat
library docs and adds another test for external entity reference
handling.  This is probably all I'll do on this ticket.
msg125382 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2011-01-04 23:27
Hi all, I think this patch would be nice to be applied, but before start working on it (like adapt it to new code & stuff), I'd like to know if we are really targetting 2.7 or should we instead targer 3.3.

Cheers, Sandro
msg125383 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-01-04 23:52
I don't think we should adding tests to 2.7, perhaps unless there are also fixes for it. So targetting 3.3+ only seems reasonable.
msg125434 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2011-01-05 16:56
Ok, I've changed the version field and refreshed the patch against py3k.
msg125451 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-01-05 18:37
Doc patch committed in r87762.
msg125452 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-01-05 18:45
Ok, I've changed "assertEquals" to "assertEqual" and committed the tests in r87765. Thank you!
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49735
2011-01-05 18:45:03pitrousetstatus: open -> closed
versions: + Python 3.2, - Python 3.3
nosy: loewis, exarkun, pitrou, sandro.tosi
messages: + msg125452

resolution: fixed
stage: patch review -> resolved
2011-01-05 18:37:43pitrousetnosy: + pitrou
messages: + msg125451
2011-01-05 16:56:10sandro.tosisetfiles: + issue5485-py3k.patch

versions: + Python 3.3, - Python 2.7
messages: + msg125434
nosy: loewis, exarkun, sandro.tosi
2011-01-04 23:52:03loewissetnosy: loewis, exarkun, sandro.tosi
messages: + msg125383
2011-01-04 23:27:53sandro.tosisetnosy: + sandro.tosi

messages: + msg125382
stage: patch review
2009-05-20 18:41:55exarkunsetfiles: + pyexpat.patch

messages: + msg88130
2009-03-13 19:12:06exarkunsetmessages: + msg83532
2009-03-13 19:11:28exarkunsetfiles: + use-foreign-dtd.2.patch

messages: + msg83531
2009-03-13 19:09:41loewissetmessages: + msg83530
2009-03-13 18:32:24exarkunsetmessages: + msg83527
2009-03-13 18:20:34loewissetnosy: + loewis
messages: + msg83525
2009-03-13 16:51:01exarkuncreate