title: Can etree.XMLParser in recover mode still throw a parse error?
body: <p>I have a utility method that parses XML using a parser created as <code>etree.XMLParser(recover=True)</code>. I would like to test failure scenarios in a unit test. Except for empty input throwing an <code>lxml.etree.XMLSyntaxError</code>, I can't seem to break the parser.</p>
  
  <p>My question is: is it possible to construct a <code>StringIO</code> or <code>BytesIO</code> input for this parser such that the parser throws a parse error?</p>
  
  <p>Here's some examples (tested with Python 3.5 and lxml 4.3.3):</p>
  
  <pre class="lang-py prettyprint-override"><code>from io import BytesIO
  from lxml import etree
  
  
  def parse(xml):
      parser = etree.XMLParser(recover=True)
      elem = etree.parse(BytesIO(xml), parser)
      print(etree.tostring(elem))
  
  
  parse(b'&lt;broken&lt;')  # prints b'&lt;broken/&gt;'
  parse(b'&lt;/lf|\jf&gt;')  # prints None
  parse('&lt;?xml encoding="ascii"?&gt;&lt;foo&gt;æøå&lt;/foo&gt;'.encode('utf-8'))  # prints b'&lt;foo/&gt;'
  parse(b'')  # Throws lxml.etree.XMLSyntaxError
  </code></pre>