[issue15775] Add StopParser() to expat

2012-09-06 Thread Nemeskey Dávid
Nemeskey Dávid added the comment: Amaury: see my previous comment. There are two problems with the method you proposed: 1. It is not mentioned in the documentation that exceptions are propagated through parse(). 2. Exceptions usually mean that an error has happened, and is not the preferred

[issue15775] Add StopParser() to expat

2012-09-06 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Your first point is true, even if the Python zen (try import this) states that Errors should never pass silently. For your second point: exceptions are a common thing in Python code. This is similar to the EAFP principle

[issue15775] Add StopParser() to expat

2012-09-05 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Below is a sample script that shows that it's possible to stop parsing XML in the middle, without an explicit call to XML_StopParser(): raise StopParsing from any handler, and catch it around the Parse() call. This method covers the two proposed use

[issue15775] Add StopParser() to expat

2012-08-31 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15775 ___ ___

[issue15775] Add StopParser() to expat

2012-08-28 Thread Nemeskey Dávid
Nemeskey Dávid added the comment: OK, then this issue has a bug part, too: it is not mentioned in the documentation that exceptions from the handler methods propagate through the Parse() method. I guess the parser can be then stopped in this way too, but it is a dirty method as opposed to

[issue15775] Add StopParser() to expat

2012-08-28 Thread Martin v . Löwis
Martin v. Löwis added the comment: nemeskeyd: would you like to work on a patch (for Python 3.4)? -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15775 ___

[issue15775] Add StopParser() to expat

2012-08-28 Thread Nemeskey Dávid
Nemeskey Dávid added the comment: loewis: I don't think it would be difficult to fix, so theoretically I'd be in. However, I don't really have the time to work on this right now. -- ___ Python tracker rep...@bugs.python.org

[issue15775] Add StopParser() to expat

2012-08-27 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: If a handler function raises an exception, the Parse() method exits and the exception is propagated; internally, this also calls XML_StopParser(). Why would one call XML_StopParser() explicitely? -- nosy: +amaury.forgeotdarc

[issue15775] Add StopParser() to expat

2012-08-24 Thread Nemeskey Dávid
New submission from Nemeskey Dávid: The C expat library provides XML_StopParser() method that allows the parsing to be stopped from the handler functions. It would be nice to have this option in Python as well, maybe by adding StopParser() method to the XMLParser class. -- components: