[issue18408] Fixes crashes found by pyfailmalloc

Stefan Behnel report at bugs.python.org
Thu Jul 18 21:49:24 CEST 2013


Stefan Behnel added the comment:

This test from lxml's ElementTree test suite crashes for me now when run against (c)ElementTree:

    def test_parser_target_error_in_start(self):
        assertEqual = self.assertEqual

        events = []
        class Target(object):
            def start(self, tag, attrib):
                events.append("start")
                assertEqual("TAG", tag)
                raise ValueError("TEST")
            def end(self, tag):
                events.append("end")
                assertEqual("TAG", tag)
            def close(self):
                return "DONE"

        parser = ET.XMLParser(target=Target())

        try:
            parser.feed("<TAG/>")
        except ValueError:
            self.assertTrue('TEST' in str(sys.exc_info()[1]))
        else:
            self.assertTrue(False)
        self.assertTrue("start" in events)

Python/ceval.c:1210: PyEval_EvalFrameEx: Assertion `!PyErr_Occurred()' failed.

(note: this is not the exact code, I removed a couple of conditions that are not used by ET)

----------
nosy: +scoder

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18408>
_______________________________________


More information about the Python-bugs-list mailing list