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: iter() not working in ElementTree
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.3
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: eli.bendersky Nosy List: Kronuz, eli.bendersky, idarbuashvili, scoder
Priority: normal Keywords:

Created on 2013-09-10 14:37 by Kronuz, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
houses.xml Kronuz, 2013-09-10 14:37 XML test file
Messages (5)
msg197441 - (view) Author: Germán Méndez Bravo (Kronuz) * Date: 2013-09-10 14:37
The added iter/itertext methods in Element are not working under certain circumstances (crashes):

This crashes:
  e = ElementTree().parse('/Users/kronuz/Desktop/tests/houses.xml')

But the problem is not there if I use bootstrapped iterators instead (from the previous commit to the one introducing Element iterator)
msg197443 - (view) Author: irakli (idarbuashvili) Date: 2013-09-10 14:50
Can you clearify under which circumstances python 3.3 crashes?
msg197451 - (view) Author: Germán Méndez Bravo (Kronuz) * Date: 2013-09-10 15:48
It crashes when I run that code snippet I posted (using the attached xml file) The problem was introduced by the commit that added iterator support.
msg197456 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2013-09-10 17:43
I'm having trouble reproducing the problem, Germán. Running with Python 3.3.2 from a couple of days ago:

Python 3.3.2+ (3.3:0eef1670f316, Sep  8 2013, 08:31:59) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree.ElementTree import *
>>> e = ElementTree().parse('houses.xml')
>>> e.iter()
<_elementtree._element_iterator object at 0x7fac621d9aa0>
>>> list(e.iter())
[<Element '{}group' at 0x7fac621e02b8>, <Element '{}house' at 0x7fac621e0368>, <Element '{}id' at 0x7fac621e0418>, <Element '{}dogs' at 0x7fac621e0470>, <Element '{}house' at 0x7fac621e04c8>, <Element '{}id' at 0x7fac621e0520>, <Element '{}dogs' at 0x7fac621e0578>]

Can you provide a patch for the ET tests that I can apply to tip of 3.3 and see this reproduced?
msg197567 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2013-09-13 12:35
I can't reproduce it with the most recent default branch (Python 3.4.0a2+ (default:c7fdb0637d0b, Sep 13 2013, 05:29:00)) either.

Unless I'm missing something, there's no issue here. Let me know if something else can be done. Otherwise I'll close the issue in a couple of days.
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63198
2013-09-15 19:10:44eli.benderskysetstatus: open -> closed
resolution: works for me
stage: test needed -> resolved
2013-09-13 12:35:36eli.benderskysetmessages: + msg197567
2013-09-10 17:43:59eli.benderskysetassignee: eli.bendersky
messages: + msg197456
stage: test needed
2013-09-10 15:48:30Kronuzsetmessages: + msg197451
2013-09-10 14:50:50idarbuashvilisetnosy: + idarbuashvili
messages: + msg197443
2013-09-10 14:37:01Kronuzcreate