summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2017-01-22 15:50:16 +0100
committerStefan Behnel <stefan_ml@behnel.de>2017-01-22 15:50:16 +0100
commitdedf215e1a1610f880189de30ccfe5db5e75a69a (patch)
tree9a9a7da8858fda3b6182f4bde89778fec392fbf7
parentee4f814711d84072f063208dcfd926db5fd40e34 (diff)
downloadpython-lxml-dedf215e1a1610f880189de30ccfe5db5e75a69a.tar.gz
repair xmlfile serialisation: comparing bytes to str always fails in Py3
-rw-r--r--src/lxml/serializer.pxi7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi
index d16b08a1..8cee18d8 100644
--- a/src/lxml/serializer.pxi
+++ b/src/lxml/serializer.pxi
@@ -1159,9 +1159,10 @@ cdef class _IncrementalFileWriter:
content = _utf8(content)
ns, name, _, _ = self._element_stack[-1]
- if c_method == OUTPUT_METHOD_HTML and \
- ns in (None, 'http://www.w3.org/1999/xhtml') and name in ('script', 'style'):
- tree.xmlOutputBufferWrite(self._c_out, len(content), content)
+ if (c_method == OUTPUT_METHOD_HTML and
+ ns in (None, b'http://www.w3.org/1999/xhtml') and
+ name in (b'script', b'style')):
+ tree.xmlOutputBufferWrite(self._c_out, len(content), _cstr(content))
else:
tree.xmlOutputBufferWriteEscape(self._c_out, _xcstr(content), NULL)