ParseError exceptions "remembering" errors from previous exceptions

Hi, It seems that the error_log from ParseError/XMLSyntaxError exceptions contains error messages from previous errors, which I assume to be a bug. Consider the following script: from lxml import etree def print_logs(s): print 'Input:', repr(s) try: elem = etree.XML(s) except etree.ParseError as e: print 'Exception error_log:' print e.error_log #etree.clear_error_log() print 'Default parser error_log:' print etree.get_default_parser().error_log print print_logs('<spam>') print_logs('<p>&ham;</p>') print_logs('eggs') You will notice that the exception error_log contains not only the errors for this particular exception, but also those of all previous ones (unless you uncomment the "etree.clear_error_log()" line). Interestingly, the parser's error_log doest not show this behaviour. Is this a bug, is using etree.clear_error_log() the way you're supposed to do it? Thanks, Steven
participants (1)
-
Steven Vereecken