cpython: 7f8cd879687b (original) (raw)

Mercurial > cpython

changeset 95892:7f8cd879687b 3.4

Issue #24125: Saved error's line and column numbers when an error is occured during closing expatreader. Fixed a regression introduced in issue #23865. [#24125]

Serhiy Storchaka storchaka@gmail.com
date Wed, 06 May 2015 09:36:06 +0300
parents 29512e2015d9
children 1fb83fa2cdef 5418ab3e5556
files Lib/test/test_sax.py Lib/xml/sax/expatreader.py
diffstat 2 files changed, 15 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_sax.py 2 Lib/xml/sax/expatreader.py 15

line wrap: on

line diff

--- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -1126,6 +1126,8 @@ class ErrorReportingTest(unittest.TestCa parser = create_parser() parser.setContentHandler(ContentHandler()) # do nothing self.assertRaises(SAXParseException, parser.parse, StringIO(""))

def test_sax_parse_exception_str(self): # pass various values from a locator to the SAXParseException to

--- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -43,6 +43,9 @@ else: _mkproxy = weakref.proxy del weakref, _weakref +class _ClosedParser:

+

--- ExpatLocator

class ExpatLocator(xmlreader.Locator): @@ -211,16 +214,24 @@ class ExpatParser(xmlreader.IncrementalP self._err_handler.fatalError(exc) def close(self):