diff options
| author | Stefan Behnel <stefan_ml@behnel.de> | 2017-03-18 10:12:25 +0100 |
|---|---|---|
| committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-03-18 10:12:25 +0100 |
| commit | a79307c5173963beb7bd03e54339e6ff7f11fb81 (patch) | |
| tree | 6b5f73668ed161348c0ef85c6ba3ac418fa940a4 /src/lxml/html | |
| parent | 91e1d273549e29510a8f431ba561381514600575 (diff) | |
| parent | 2d35d07293b9115120e84193f51035aab094f2e8 (diff) | |
| download | python-lxml-a79307c5173963beb7bd03e54339e6ff7f11fb81.tar.gz | |
merge lxml-3.7 branch into master
Diffstat (limited to 'src/lxml/html')
| -rw-r--r-- | src/lxml/html/html5parser.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lxml/html/html5parser.py b/src/lxml/html/html5parser.py index ba9d41b3..ed70b340 100644 --- a/src/lxml/html/html5parser.py +++ b/src/lxml/html/html5parser.py @@ -148,10 +148,10 @@ def fromstring(html, guess_charset=True, parser=None): # document starts with doctype or <html>, full document! start = html[:50] - if hasattr(start, 'decode'): - # In python3, we may have been presented with a bytes object. - # Decode in ascii, that also covers latin-1 and utf-8 for the - # characters we need + if isinstance(start, bytes): + # Allow text comparison in python3. + # Decode as ascii, that also covers latin-1 and utf-8 for the + # characters we need. start = start.decode('ascii', 'replace') start = start.lstrip().lower() |
