classification
Title: cElementTree iterparse does not support "parser" argument
Type: behavior Stage: needs patch
Components: Documentation, XML Versions: Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Shugyousha, adrian_nye, docs@python, effbot, flox
Priority: normal Keywords: patch

Created on 2010-08-28 21:51 by adrian_nye, last changed 2011-11-25 15:22 by Shugyousha.

Files
File name Uploaded Description Edit
issue9708.Python330a0.patch Shugyousha, 2011-11-25 15:22 Simple patch in c module glue code review
Messages (3)
msg115173 - (view) Author: Adrian Nye (adrian_nye) Date: 2010-08-28 21:51
The (python) ElementTree library began in 2.7 to support the "parser" argument, but cElementTree does not support it.

Either cElementTree should support it, or the documentation should mention that it does not.
msg146596 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2011-10-29 03:07
Documentation should be fixed for 3.2 and 2.7.
Patch welcomed.
msg148324 - (view) Author: Silvan Jegen (Shugyousha) Date: 2011-11-25 15:22
I changed a few lines in the glue code of the _elementtree.c Module of Python 3.3.0a0 to add support for the "parser" argument. I do have to admit though that I am not familiar with the Python/C-API so this solution may not be ideal (i. e. it may be falling back to the Python implementation of iterparse without me realizing).

Please note that it is not possible to give an ElementTree.XMLParser instance as a parameter to the cElementTree.iterparse function (which may not be desirable in any case) using this patch.

I assume that the patch will be applicable to Python 2.7.x as well, but I did not try it. I can apply/adapt it to Python 2.7.x, if you think that would be useful.
History
Date User Action Args
2011-11-25 15:22:08Shugyoushasetfiles: + issue9708.Python330a0.patch

nosy: + Shugyousha
messages: + msg148324

keywords: + patch
2011-10-29 03:07:06floxsetnosy: + docs@python
messages: + msg146596

assignee: docs@python
components: + Documentation
stage: test needed -> needs patch
2010-09-03 17:00:04floxsetnosy: + effbot
stage: test needed
type: behavior

versions: + Python 3.2
2010-08-28 23:53:21r.david.murraysetnosy: + flox
2010-08-28 21:51:34adrian_nyecreate