diff --git a/src/lxml/etree.pyx b/src/lxml/etree.pyx index 0d5c38b0c..81c97c96a 100644 --- a/src/lxml/etree.pyx +++ b/src/lxml/etree.pyx @@ -1,6 +1,6 @@ # cython: binding=True # cython: auto_pickle=False -# cython: language_level=3str +# cython: language_level=3 """ The ``lxml.etree`` module implements the extended ElementTree API for XML. diff --git a/src/lxml/objectify.pyx b/src/lxml/objectify.pyx index de1389343..b09da5145 100644 --- a/src/lxml/objectify.pyx +++ b/src/lxml/objectify.pyx @@ -1,6 +1,6 @@ # cython: binding=True # cython: auto_pickle=False -# cython: language_level=3str +# cython: language_level=3 """ The ``lxml.objectify`` module implements a Python object API for XML. diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi index 36d92b696..9af23f6c1 100644 --- a/src/lxml/serializer.pxi +++ b/src/lxml/serializer.pxi @@ -456,7 +456,7 @@ cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string): base = cur = string while cur[0] != 0: - if cur[0] == '\n': + if cur[0] == b'\n': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) @@ -464,7 +464,7 @@ cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string): cur += 1 base = cur - elif cur[0] == '\r': + elif cur[0] == b'\r': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) @@ -472,7 +472,7 @@ cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string): cur += 1 base = cur - elif cur[0] == '\t': + elif cur[0] == b'\t': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) @@ -480,7 +480,7 @@ cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string): cur += 1 base = cur - elif cur[0] == '"': + elif cur[0] == b'"': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) @@ -496,14 +496,14 @@ cdef _write_attr_string(tree.xmlOutputBuffer* buf, const char *string): cur += 1 base = cur - elif cur[0] == '>': + elif cur[0] == b'>': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) tree.xmlOutputBufferWrite(buf, 4, ">") cur += 1 base = cur - elif cur[0] == '&': + elif cur[0] == b'&': if base != cur: tree.xmlOutputBufferWrite(buf, cur - base, base) diff --git a/src/lxml/xmlerror.pxi b/src/lxml/xmlerror.pxi index 6ef5c857e..2191c8620 100644 --- a/src/lxml/xmlerror.pxi +++ b/src/lxml/xmlerror.pxi @@ -716,32 +716,32 @@ cdef void _receiveGenericError(void* c_log_handler, int c_domain, c_name_pos = c_pos = msg format_count = 0 while c_pos[0]: - if c_pos[0] == '%': + if c_pos[0] == b'%': c_pos += 1 - if c_pos[0] == 's': # "%s" + if c_pos[0] == b's': # "%s" format_count += 1 c_str = cvarargs.va_charptr(args) if c_pos == msg + 1: c_text = c_str # msg == "%s..." - elif c_name_pos[0] == 'e': + elif c_name_pos[0] == b'e': if cstring_h.strncmp(c_name_pos, 'element %s', 10) == 0: c_element = c_str - elif c_name_pos[0] == 'f': + elif c_name_pos[0] == b'f': if cstring_h.strncmp(c_name_pos, 'file %s', 7) == 0: if cstring_h.strncmp('string://__STRING__XSLT', c_str, 23) == 0: c_str = '' c_error.file = c_str - elif c_pos[0] == 'd': # "%d" + elif c_pos[0] == b'd': # "%d" format_count += 1 c_int = cvarargs.va_int(args) if cstring_h.strncmp(c_name_pos, 'line %d', 7) == 0: c_error.line = c_int - elif c_pos[0] != '%': # "%%" == "%" + elif c_pos[0] != b'%': # "%%" == "%" format_count += 1 break # unexpected format or end of string => abort - elif c_pos[0] == ' ': - if c_pos[1] != '%': + elif c_pos[0] == b' ': + if c_pos[1] != b'%': c_name_pos = c_pos + 1 c_pos += 1