Issue 5485: pyexpat has no unit tests for UseForeignDTD functionality (original) (raw)

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

Files
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 SetParamEntityParsing(XML_PARAM_ENTITY_PARSING_ALWAYS) 2. Pass a well-formed document, e.g. ""
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!
History
Date User Action Args
2022-04-11 14:56:46 admin set github: 49735
2011-01-05 18:45:03 pitrou set status: open -> closedversions: + Python 3.2, - Python 3.3nosy:loewis, exarkun, pitrou, sandro.tosimessages: + resolution: fixedstage: patch review -> resolved
2011-01-05 18:37:43 pitrou set nosy: + pitroumessages: +
2011-01-05 16:56:10 sandro.tosi set files: + issue5485-py3k.patchversions: + Python 3.3, - Python 2.7messages: + nosy:loewis, exarkun, sandro.tosi
2011-01-04 23:52:03 loewis set nosy:loewis, exarkun, sandro.tosimessages: +
2011-01-04 23:27:53 sandro.tosi set nosy: + sandro.tosimessages: + stage: patch review
2009-05-20 18:41:55 exarkun set files: + pyexpat.patchmessages: +
2009-03-13 19:12:06 exarkun set messages: +
2009-03-13 19:11:28 exarkun set files: + use-foreign-dtd.2.patchmessages: +
2009-03-13 19:09:41 loewis set messages: +
2009-03-13 18:32:24 exarkun set messages: +
2009-03-13 18:20:34 loewis set nosy: + loewismessages: +
2009-03-13 16:51:01 exarkun create