[issue2892] improve cElementTree iterparse error handling

2011-11-01 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 23ffaf975267 by Florent Xicluna in branch '3.2':
Closes #2892: preserve iterparse events in case of SyntaxError.
http://hg.python.org/cpython/rev/23ffaf975267

New changeset ca1e2cf2947b by Florent Xicluna in branch 'default':
Merge 3.2: issue #2892
http://hg.python.org/cpython/rev/ca1e2cf2947b

New changeset e1dde980a92c by Florent Xicluna in branch '2.7':
Issue #2892: preserve iterparse events in case of SyntaxError
http://hg.python.org/cpython/rev/e1dde980a92c

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2011-10-28 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

unfortunately, I did not find the fix and the test in the upstream repository.

AFAIK, upstream should be there:
https://bitbucket.org/effbot/et-2009-provolone/src

--
components: +XML -Extension Modules
type: feature request - behavior
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2011-10-28 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Proposed patch for 3.3.

--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file23544/issue2892_etree_iterparse.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2010-10-05 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

If it's a regression, it should be fixed in some 2.7.x  release
Is there a patch somewhere?

--
nosy: +amaury.forgeotdarc
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2010-06-11 Thread Hrvoje Nikšić

Hrvoje Nikšić hnik...@gmail.com added the comment:

Here is a small test case that demonstrates the problem, expected behavior and 
actual behavior:

{{{
for ev in xml.etree.cElementTree.iterparse(StringIO('x/xrubbish'), 
events=('start', 'end')):
print ev
}}}

The above code should first print the two events (start and end), and then 
raise the exception.  In Python 2.7 it runs like this:

{{{
 for ev in xml.etree.cElementTree.iterparse(StringIO('x/xrubbish'), 
 events=('start', 'end')):
...   print ev
... 
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 84, in next
cElementTree.ParseError: junk after document element: line 1, column 7
}}}

Expected behavior, obtained with my patch, is that it runs like this:

{{{
 for ev in my_iterparse(StringIO('x/xrubbish'), events=('start', 'end')):
...  print ev
... 
('start', Element 'x' at 0xb771cba8)
('end', Element 'x' at 0xb771cba8)
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 26, in __iter__
cElementTree.ParseError: junk after document element: line 1, column 7
}}}

The difference is, of course, only visible when printing events.  A 
side-effect-free operation, such as building a list using list(iterparse(...)) 
would behave exactly the same before and after the change.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2010-06-11 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +flox

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2010-06-11 Thread Fredrik Lundh

Fredrik Lundh fred...@effbot.org added the comment:

Note that this was fixed in upstream 1.3 (and verified by the selftests), but 
the fix and test was apparently lost when that code was merged into 2.7.  Since 
2.7 is supposed to ship with 1.3, this is a regression, not a feature request.

(But 2.7 is in rc, and I'm on vacation, so I guess it's a bit too late to do 
anything about that.  I'll leave the final decision to flox and the python-dev 
crowd.)

--
assignee: effbot - flox
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2010-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
type: behavior - feature request
versions: +Python 3.2 -Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2892
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2008-05-16 Thread Hrvoje Nikšić

New submission from Hrvoje Nikšić [EMAIL PROTECTED]:

In some cases it is unfortunate that any error in the XML chunk seen by
the buffer prevents the events generated before the error from being
delivered.  For example, in some cases valid XML is embedded in a larger
file or stream, and it is useful to be able to ignore text that follows
the root tag, if any.

The iterparse API and expat itself make this possible, but it doesn't
work because in case of a parsing exception, iterparse doesn't deliver
the events generated before the exception.  A simple change to iterparse
makes this possible, however.  I would like to share the change with you
for possible inclusion in a future release.  Note that this change
shouldn't affect the semantics of iterparse: the exception is still
delivered to the caller, the only difference is that the events
generated by expat before the exception are not forgotten.

I am attaching a diff between the current implementation of iterparse,
and a modified one that fixes this problem.

--
components: Extension Modules
files: patch
messages: 66935
nosy: hniksic
severity: normal
status: open
title: improve cElementTree iterparse error handling
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file10343/patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2892
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2892] improve cElementTree iterparse error handling

2008-05-16 Thread Georg Brandl

Changes by Georg Brandl [EMAIL PROTECTED]:


--
assignee:  - effbot
nosy: +effbot

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2892
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com