lxml/lxml — Issue #33: lxml.html.fromstring does not handle bytes-objects correct in python 3
Author: canaaerus
Created: 2012-02-29 00:15:10+00:00
State: open

When lxml.html.fromstring is called in python 3 and given a bytes-object, the following error occurs:

File "/usr/lib64/python3.2/site-packages/lxml/html/__init__.py", line 630, in fromstring
if start.startswith('"))

The error occurs, because the type of the string-literals in the lxml-code (=unicode-strings) does not match the type of the html-data (=byte-strings).
Also giving the html-data as unicode-strings is not appropriate, because this might clash with the encoding given in the html-data.

I am using python 3.2.2 with lxml 2.3.1 on gentoo, but looking at the current git-code it seems like the issue is still present.